当前位置: 首页>>代码示例>>Java>>正文


Java JButton.setAlignmentX方法代码示例

本文整理汇总了Java中javax.swing.JButton.setAlignmentX方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setAlignmentX方法的具体用法?Java JButton.setAlignmentX怎么用?Java JButton.setAlignmentX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JButton的用法示例。


在下文中一共展示了JButton.setAlignmentX方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TablePrintDemo

import javax.swing.JButton; //导入方法依赖的package包/类
public TablePrintDemo() {
    super();
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    table = new JTable(new MyTableModel());
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);

    // Add the scroll pane to this panel.
    add(scrollPane);

    // Add a print button.
    JButton printButton = new JButton("Print");
    printButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    printButton.addActionListener(this);
    add(printButton);

}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:22,代码来源:TablePrintDemo.java

示例2: createButtons

import javax.swing.JButton; //导入方法依赖的package包/类
protected JPanel createButtons()
{
	setButton = new JButton(CurrentLocale.get("com.dytech.edge.admin.script.set")); //$NON-NLS-1$
	setButton.setAlignmentX(Component.CENTER_ALIGNMENT);
	setButton.setEnabled(false);
	setButton.addActionListener(new SetHandler());

	addButton = new JButton(CurrentLocale.get("com.dytech.edge.admin.script.add")); //$NON-NLS-1$
	addButton.setAlignmentX(Component.CENTER_ALIGNMENT);
	addButton.addActionListener(new AddHandler());

	JPanel all = new JPanel();
	all.setLayout(new BoxLayout(all, BoxLayout.Y_AXIS));
	all.add(Box.createVerticalGlue());
	all.add(addButton);
	all.add(Box.createRigidArea(new Dimension(0, 5)));
	all.add(setButton);
	all.add(Box.createVerticalGlue());

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:WhereModel.java

示例3: InitPage

import javax.swing.JButton; //导入方法依赖的package包/类
public InitPage(Menu crMenu) {
	this.crMenu = crMenu;

	setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
	JButton newPetriButton = new JButton("New Petri Net");
	JButton newCrButton = new JButton("New CR Graph");

	newCrButton.addActionListener(this);
	newCrButton.setActionCommand("new_cr");
	newCrButton.setAlignmentX(Component.CENTER_ALIGNMENT);

	newPetriButton.addActionListener(this);
	newPetriButton.setActionCommand("new_petri");
	newPetriButton.setAlignmentX(Component.CENTER_ALIGNMENT);

	JLabel statusLabel = new JLabel("Please create a new graph");
	statusLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
	// statusLabel.setLocation(150, 150);

	add(statusLabel);
	add(newCrButton);
	add(newPetriButton);

}
 
开发者ID:tslaats,项目名称:SE2017-Team2,代码行数:25,代码来源:InitPage.java

示例4: createZoomInButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createZoomInButton() {
    JButton inButton = new JButton(ImageUtilities.image2Icon(ImageUtilities.loadImage("org/netbeans/modules/debugger/jpda/visual/resources/zoomIn.gif")));
    inButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomIn"));
    inButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomInA11yDescr"));
    inButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            canvas.zoomIn();
        }
    });
    inButton.setAlignmentX(CENTER_ALIGNMENT);
    return inButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例5: createZoomOutButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createZoomOutButton() {
    JButton outButton = new JButton(ImageUtilities.image2Icon(ImageUtilities.loadImage("org/netbeans/modules/debugger/jpda/visual/resources/zoomOut.gif")));
    outButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomOut"));
    outButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomOutA11yDescr"));
    outButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            canvas.zoomOut();
        }
    });
    outButton.setAlignmentX(CENTER_ALIGNMENT);
    return outButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例6: createZoomOrigButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createZoomOrigButton() {
    JButton origButton = new JButton(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomOrig"));
    origButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomOrig"));
    origButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomOrigA11yDescr"));
    origButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            canvas.zoom(1);
        }
    });
    origButton.setAlignmentX(CENTER_ALIGNMENT);
    return origButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例7: createZoomFitButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createZoomFitButton() {
    JButton fitButton = new JButton(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomFit"));
    fitButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomFit"));
    fitButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomFitA11yDescr"));
    fitButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            canvas.zoomFit();
        }
    });
    fitButton.setAlignmentX(CENTER_ALIGNMENT);
    return fitButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例8: afficher

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Affiche les �lements graphiques sur la fen�tre
 */
private void afficher() {
	this.panPrinc = new JPanel();
	this.panPrinc.setLayout(new BoxLayout(this.panPrinc, BoxLayout.PAGE_AXIS));

	//Label identifiant
	JLabel labIdentifiant = new JLabel("Identifiant");
	labIdentifiant.setFont(new Font("Arial", Font.PLAIN, 20));
	labIdentifiant.setAlignmentX(Component.CENTER_ALIGNMENT);

	//Label mot de passe
	JLabel labMdp = new JLabel("Mot de passe");
	labMdp.setFont(new Font("Arial", Font.PLAIN, 20));
	labMdp.setAlignmentX(Component.CENTER_ALIGNMENT);

	//Champ de l'identifiant
	this.fieldName = new JTextField();
	this.fieldName.setPreferredSize(new Dimension(150,25));
	this.fieldName.setAlignmentX(Component.CENTER_ALIGNMENT);

	//Champ du mot de passe
	this.fieldPassword = new JPasswordField();
	this.fieldPassword.setEchoChar('*');
	this.fieldPassword.setPreferredSize(new Dimension(150,25));
	this.fieldPassword.setAlignmentX(Component.CENTER_ALIGNMENT);

	//Bouton connecter
	butConnecter = new JButton();
	butConnecter.setAlignmentX(Component.CENTER_ALIGNMENT);

	this.panPrinc.add(Box.createVerticalStrut(180));
	this.panPrinc.add(labIdentifiant);
	this.panPrinc.add(this.fieldName);
	this.panPrinc.add(Box.createVerticalStrut(10));
	this.panPrinc.add(labMdp);
	this.panPrinc.add(this.fieldPassword);
	this.panPrinc.add(Box.createVerticalStrut(40));
	this.panPrinc.add(butConnecter);
}
 
开发者ID:antonin-arquey,项目名称:polyevent,代码行数:42,代码来源:LoginView.java

示例9: createProgressComponent

import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createProgressComponent() {
    progressLabel = new JLabel(getDisplayName());

    progressBar = super.getProgressComponent();

    stopButton = new JButton(NbBundle.getMessage(WizardStepProgressSupport.class, "BK2022")); // NOI18N
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancel();
        }
    });

    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);

    progressLine = new JPanel();
    progressLine.add(progressBar);
    progressLine.add(Box.createHorizontalStrut(
                            LayoutStyle.getInstance()
                            .getPreferredGap(progressBar,
                                             stopButton,
                                             RELATED,
                                             SwingConstants.EAST,
                                             progressLine)));
    progressLine.add(stopButton);

    progressLine.setLayout(new BoxLayout(progressLine, BoxLayout.X_AXIS));
    progressBar.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    stopButton.setAlignmentX(JComponent.CENTER_ALIGNMENT);

    layout.setHorizontalGroup(
            layout.createParallelGroup(LEADING)
            .addComponent(progressLabel)
            .addComponent(progressLine));
    layout.setVerticalGroup(
            layout.createSequentialGroup()
            .addComponent(progressLabel)
            .addPreferredGap(RELATED)
            .addComponent(progressLine));
    panel.setLayout(layout);

    layout.setHonorsVisibility(false);   //hiding should not affect prefsize

    progressLabel.setVisible(false);
    progressLine.setVisible(false);

    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:WizardStepProgressSupport.java


注:本文中的javax.swing.JButton.setAlignmentX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。