本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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) );
}
示例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);
}
示例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;
}
示例10: getEmptyJButton
import javax.swing.JButton; //导入方法依赖的package包/类
final private static JButton getEmptyJButton() {
final JButton objLjButton = new JButton();
objLjButton.setSize(0, 0);
return objLjButton;
}