當前位置: 首頁>>代碼示例>>Java>>正文


Java JButton.setSize方法代碼示例

本文整理匯總了Java中javax.swing.JButton.setSize方法的典型用法代碼示例。如果您正苦於以下問題:Java JButton.setSize方法的具體用法?Java JButton.setSize怎麽用?Java JButton.setSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JButton的用法示例。


在下文中一共展示了JButton.setSize方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getContributeButton

import javax.swing.JButton; //導入方法依賴的package包/類
public JButton getContributeButton() {
	JButton contributeB = new JButton();
	contributeB.setLayout(new BorderLayout());
	JLabel label1 = new JLabel("Contribute");
	JLabel label2 = new JLabel("Data");
	label1.setFont(new Font("Arial", Font.BOLD, 11));
	contributeB.add(BorderLayout.CENTER,label1);
	label2.setFont(new Font("Arial", Font.BOLD, 11));
	label2.setHorizontalAlignment(SwingConstants.CENTER);
	contributeB.add(BorderLayout.SOUTH,label2);
	contributeB.setSize(new Dimension(115, 30));
	contributeB.setMargin(new Insets(0, 0, 0, 0));
	contributeB.setBackground(new Color( 224, 224, 224)); ;
	contributeB.setFont(new Font("Arial", Font.BOLD, 11));
	contributeB.setHorizontalAlignment(SwingConstants.LEFT);
	
	return contributeB;
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:19,代碼來源:MapTools.java

示例2: getJButtonExample

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Gets an example JButton.
 * @return the JButton example
 */
private JButton getJButtonExample() {
	
	JButton myButton = new JButton();
	myButton.setText("! My customized button !");
	myButton.setToolTipText("This is the tool tip text of your customized toolbar button");
	myButton.setSize(36, 36);
	// --------------------------------------------------------------------
	// Usually we took this Dimension and left the setText() empty !!
	// myButton.setPreferredSize( new Dimension(26,26) ); 
	// --------------------------------------------------------------------
	myButton.setPreferredSize( new Dimension(170, 26) );
	// --------------------------------------------------------------------
	myButton.setIcon(GlobalInfo.getInternalImageIcon("Refresh.png"));
	myButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent arg0) {
			System.out.println("This event came from your customized toolbar-button !");
		}
	});
	return myButton;
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:26,代碼來源:PlugInExample.java

示例3: erzeugeAusleihButton

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Erzeugt den Ausleih-Button.
 */
private void erzeugeAusleihButton()
{
    JPanel _buttonPanel = new JPanel();
    _ausleihePanel.add(_buttonPanel, BorderLayout.SOUTH);
    _buttonPanel.setPreferredSize(new Dimension(-1, 110));
    _buttonPanel.setSize(-1, -1);
    _buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    _ausleihButton = new JButton();
    _buttonPanel.add(_ausleihButton);
    _ausleihButton.setText("ausleihen");
    _ausleihButton.setPreferredSize(new Dimension(140, 100));
    _ausleihButton.setSize(-1, -1);
    _ausleihButton.setFont(UIConstants.BUTTON_FONT);
    _ausleihButton.setEnabled(false);
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:20,代碼來源:AusleiheUI.java

示例4: erzeugeAusleihButton

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Erzeugt den Ausleih-Button.
 */
private void erzeugeAusleihButton()
{
    JPanel _buttonPanel = new JPanel();
    _ausleihePanel.add(_buttonPanel, BorderLayout.SOUTH);
    _buttonPanel.setPreferredSize(new Dimension(-1, 110));
    _buttonPanel.setSize(-1, -1);
    _buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    _vormerkenButton = new JButton();
    _buttonPanel.add(_vormerkenButton);
    _vormerkenButton.setText("vormerken");
    _vormerkenButton.setPreferredSize(new Dimension(140, 100));
    _vormerkenButton.setSize(-1, -1);
    _vormerkenButton.setFont(UIConstants.BUTTON_FONT);
    _vormerkenButton.setEnabled(false);
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:20,代碼來源:VormerkUI.java

示例5: erzeugeRuecknahmeButton

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Erzeuge den Rücknahme-Button.
 */
private void erzeugeRuecknahmeButton()
{
    JPanel buttonPanel = new JPanel();
    _ruecknahmePanel.add(buttonPanel, BorderLayout.SOUTH);
    buttonPanel.setPreferredSize(new java.awt.Dimension(-1, 110));
    buttonPanel.setSize(-1, -1);
    buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    _ruecknahmeButton = new JButton();
    buttonPanel.add(_ruecknahmeButton);
    _ruecknahmeButton.setText("zurücknehmen");
    _ruecknahmeButton.setPreferredSize(new java.awt.Dimension(140, 100));
    _ruecknahmeButton.setSize(-1, -1);
    _ruecknahmeButton.setEnabled(false);
    _ruecknahmeButton.setFont(UIConstants.BUTTON_FONT);
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:20,代碼來源:RueckgabeUI.java

示例6: slam

import javax.swing.JButton; //導入方法依賴的package包/類
private static void slam(final boolean lock) {
    JButton button = new JButton("HI");
    button.setSize(100, 100);
    BufferedImage image = new BufferedImage(100, 100,
                                            BufferedImage.TYPE_INT_RGB);
    for (int i = 0; i < LOOP_COUNT; i++) {
        Graphics g = image.getGraphics();
        if (lock) {
            synchronized (button.getTreeLock()) {
                button.paint(g);
            }
        } else {
            button.paint(g);
        }
        g.dispose();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:bug6190373.java

示例7: StartUp

import javax.swing.JButton; //導入方法依賴的package包/類
public StartUp( int which ) {
	try {
		URL url = null;
		switch (which) {
			case MapApp.MERCATOR_MAP:
				url = cl.getResource(startUpPath +"smallmapV3.jpg"); //New version3 images
				break;
			case MapApp.SOUTH_POLAR_MAP:
				url = cl.getResource(startUpPath + "MapAppSouthV3.jpg");
				break;
			case MapApp.NORTH_POLAR_MAP:
				url = cl.getResource(startUpPath + "MapAppNorthV3.jpg");
				break;
			case MapApp.WORLDWIND:
				url = cl.getResource(startUpPath + "VirtualOceanV3.jpg");
				break;
			default:
				url = cl.getResource(startUpPath + "smallmap.jpg");
		}
		image = ImageIO.read(url);
	} catch (Exception ex) {
		System.out.println(ex + " null");
		image=null;
	}
	setLayout(null);
	label = new JLabel("Initializing MapApp...");
	label.setFont( new Font("SansSerif", Font.PLAIN, 12) );
	label.setForeground( Color.black );
//	add( label );
	label.setLocation(10, 50);
	label.setSize( label.getPreferredSize() );
	JButton button = new JButton( "Abort" );
	add( button );
	button.setLocation( 3, 3);
	button.setSize( button.getPreferredSize() );
	button.addActionListener( this );
//	System.out.println( getComponentCount() + " components" );
	setBorder( BorderFactory.createLineBorder(Color.black, 2) );
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:40,代碼來源:StartUp.java

示例8: buttonColorActionPerformed

import javax.swing.JButton; //導入方法依賴的package包/類
private void buttonColorActionPerformed(
    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonColorActionPerformed

    final JDialog di = new JDialog(this, true);
    di.setTitle(getLocaleMessage("dialog.select_color"));
    final JColorChooser cc = new JColorChooser(
        Color.decode("#" + textFieldFontColor.getText()));
    di.setSize(450, 440);
    LayoutManager l = new FlowLayout(2, 10, 10);
    di.setLayout(l);
    di.add(cc);
    final JButton but = new JButton(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            textFieldFontColor
                .setText(
                    Integer.toHexString(cc.getColor().getRGB()).substring(2).toUpperCase());
            runningLabel.setForeground(Color.decode("#" + textFieldFontColor.getText()));
            di.setVisible(false);
        }
    });
    but.setText(getLocaleMessage("dialog.select"));
    but.setSize(20, 20);
    di.add(but);
    Uses.setLocation(di);
    di.setVisible(true);

}
 
開發者ID:bcgov,項目名稱:sbc-qsystem,代碼行數:30,代碼來源:FBoardParams.java

示例9: createActionButton

import javax.swing.JButton; //導入方法依賴的package包/類
/**
 * Crea un pulsante
 * @param action l'azione associata al pulsante
 * @return il pulsante creato
 */
private JButton createActionButton(ActionSet action) {
    JButton button = new JButton(action.getName());
    button.setSize(100, 30);
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ActionFactory factory = new ActionFactory();
            try 
            {
                selectedAction = factory.createAction(action, 0);
            }
            catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                System.err.println("Errore!");
            }
            if (selectedAction.getActionType() == ActionSet.BET || selectedAction.getActionType() == ActionSet.RAISE) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        removeAll();
                        add(amountPanel);
                        repaint();
                        validate();
                    }
                });
                amountPanel.act(selectedAction);
            }
            else
            {
                if (game.isInTurn()) 
                {
                    //System.out.println(JSONEncoder.getInstance().encodeAct(selectedAction));
                    Sender.getInstance().sendAction(selectedAction);
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            resetPanel();
                        }
                    });
                    game.setInTurn(false);                    
                }
            } 
        }
    });
    return button;
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-J,代碼行數:51,代碼來源:ControlPanel.java

示例10: getEmptyJButton

import javax.swing.JButton; //導入方法依賴的package包/類
final private static JButton getEmptyJButton() {
	final JButton objLjButton = new JButton();
	objLjButton.setSize(0, 0);
	return objLjButton;
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:6,代碼來源:NoArrowJScrollBarUI.java


注:本文中的javax.swing.JButton.setSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。