java gui jlabel_Java JLabel.setMinimumSize方法代码示例

import javax.swing.JLabel; //导入方法依赖的package包/类

/**

* Initializes the GUI.

*/

private void initGUI() {

realOuterPanel = new JPanel(new BorderLayout());

outerLayer = new JLayer(realOuterPanel);

savingGlassPane = new TransparentGlassPanePanel(WAITING_ICON,

I18N.getGUILabel("configurable_dialog.saving_configurables"), getBackground(), 0.5f);

outerLayer.setGlassPane(savingGlassPane);

savingGlassPane.setVisible(false);

JPanel pagePanel = new JPanel(new BorderLayout());

// list of configurables

JPanel configPanel = createConfigPanel();

// force size so it does not resize itself depending on entered values

configPanel.setMinimumSize(CONFIG_LIST_SIZE);

configPanel.setMaximumSize(CONFIG_LIST_SIZE);

configPanel.setPreferredSize(CONFIG_LIST_SIZE);

buttonPanel = createConfigurableButtonPanel();

// create middle spacer

JLabel spacer = new JLabel();

spacer.setMinimumSize(DIMENSION_SPACER_MIDDLE);

spacer.setMaximumSize(DIMENSION_SPACER_MIDDLE);

spacer.setPreferredSize(DIMENSION_SPACER_MIDDLE);

// add both to an outer panel for layout reasons

JPanel outerConfigPanel = new JPanel(new BorderLayout());

outerConfigPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.LIGHT_GRAY));

outerConfigPanel.add(configPanel, BorderLayout.CENTER);

outerConfigPanel.add(buttonPanel, BorderLayout.SOUTH);

// another panel for layouting

JPanel outermostConfigPanel = new JPanel(new BorderLayout());

outermostConfigPanel.add(outerConfigPanel, BorderLayout.CENTER);

outermostConfigPanel.add(spacer, BorderLayout.EAST);

// glass pane showed if the user is not able to edit connections due to an old version of

// the server

simpleGlassPane = new TransparentGlassPanePanel(null, null, getBackground(), 0.5f);

// panel displaying the selected configurable

JPanel paramPanel = createParameterPanel();

GridBagConstraints c = new GridBagConstraints();

c.fill = GridBagConstraints.BOTH;

c.weightx = 1;

c.weighty = 0.3;

c.gridwidth = GridBagConstraints.REMAINDER;

// add panels to page panel

pagePanel.add(outermostConfigPanel, BorderLayout.WEST);

pagePanel.add(paramPanel, BorderLayout.CENTER);

// add page and button panel to outer panel

realOuterPanel.add(pagePanel, BorderLayout.CENTER);

layoutDefault(outerLayer, makeSaveButton(), makeCancel());

setDefaultSize(ButtonDialog.HUGE);

setLocationRelativeTo(ApplicationFrame.getApplicationFrame());

setModal(true);

setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

addWindowListener(new WindowAdapter() {

@Override

public void windowClosing(WindowEvent e) {

cancelButton.doClick();

}

});

updateButtonState(true);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值