本文整理汇总了Java中javax.swing.JSeparator.getPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JSeparator.getPreferredSize方法的具体用法?Java JSeparator.getPreferredSize怎么用?Java JSeparator.getPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSeparator
的用法示例。
在下文中一共展示了JSeparator.getPreferredSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSeparator
import javax.swing.JSeparator; //导入方法依赖的package包/类
public void addSeparator() {
if (!UIUtils.isMetalLookAndFeel()) {
super.addSeparator();
} else {
final JSeparator separator = new JSeparator(JSeparator.VERTICAL);
final int WDTH = separator.getPreferredSize().width;
final Dimension SIZE = new Dimension(new JToolBar.Separator().getSeparatorSize().width, 12);
JPanel panel = new JPanel(null) {
public Dimension getPreferredSize() { return SIZE; }
public Dimension getMaximumSize() { return SIZE; }
public Dimension getMinimumSize() { return SIZE; }
public void doLayout() {
int x = (getWidth() - WDTH) / 2;
int y = (getHeight()- SIZE.height) / 2;
separator.setBounds(x, y, WDTH, SIZE.height);
}
};
panel.setOpaque(false);
panel.add(separator);
super.add(panel);
}
}
示例2: setup
import javax.swing.JSeparator; //导入方法依赖的package包/类
@Override
protected void setup()
{
final JComponent south = createSouth();
final JComponent north = createNamePanel(new JPanel());
final JSeparator separator1 = new JSeparator();
final JSeparator separator2 = new JSeparator();
final int height3 = north.getPreferredSize().height;
final int height2 = separator1.getPreferredSize().height;
final int height4 = south.getPreferredSize().height;
final int[] rows = {height3, 5, height2, 5, height4, 5, height2};
final int[] cols = {600};
setLayout(new TableLayout(rows, cols));
add(north, new Rectangle(0, 0, 1, 1));
add(separator1, new Rectangle(0, 2, 1, 1));
add(south, new Rectangle(0, 4, 1, 1));
add(separator2, new Rectangle(0, 6, 1, 1));
}
示例3: setupGUI
import javax.swing.JSeparator; //导入方法依赖的package包/类
private void setupGUI()
{
JComponent whoCanPanel = createWhoCanPanel();
JComponent modePanel = createModePanel();
container = new JPanel(new GridLayout(1, 1));
JSeparator separator = new JSeparator();
final int height1 = whoCanPanel.getPreferredSize().height;
final int height2 = modePanel.getMinimumSize().height;
final int height3 = separator.getPreferredSize().height;
final int[] rows = {height1, height2, height3, TableLayout.FILL,};
final int[] cols = {TableLayout.DOUBLE_FILL, TableLayout.FILL,};
setLayout(new TableLayout(rows, cols));
add(whoCanPanel, new Rectangle(0, 0, 1, 1));
add(modePanel, new Rectangle(0, 1, 2, 1));
add(separator, new Rectangle(0, 2, 2, 1));
add(container, new Rectangle(0, 3, 2, 1));
}
示例4: LabelSeparator
import javax.swing.JSeparator; //导入方法依赖的package包/类
public LabelSeparator(JLabel label)
{
JSeparator separator = new JSeparator();
final int height1 = label.getPreferredSize().height;
final int height2 = separator.getPreferredSize().height;
final int height3 = (height1 - height2) / 2;
final int width1 = label.getPreferredSize().width;
final int[] rows = {height3, height2, height3,};
final int[] cols = {width1, TableLayout.FILL,};
setLayout(new TableLayout(rows, cols));
add(label, new Rectangle(0, 0, 1, 3));
add(separator, new Rectangle(1, 1, 1, 1));
}
示例5: createConfigButtons
import javax.swing.JSeparator; //导入方法依赖的package包/类
private JComponent createConfigButtons()
{
JSeparator separator = new JSeparator();
add = new JButton("Add Server");
edit = new JButton("Edit Server");
remove = new JButton("Remove Server");
proxy = new JButton("Proxy Settings");
add.addActionListener(this);
edit.addActionListener(this);
remove.addActionListener(this);
proxy.addActionListener(this);
final int height1 = add.getPreferredSize().height;
final int height2 = separator.getPreferredSize().height;
final int width1 = remove.getPreferredSize().width;
final int width2 = proxy.getPreferredSize().width;
final int width3 = Math.max(width1, width2);
final int[] rows = {height1, height1, height2,};
final int[] cols = {TableLayout.FILL, width3, width3, width3, TableLayout.FILL,};
JPanel all = new JPanel(new TableLayout(rows, cols));
all.add(add, new Rectangle(1, 0, 1, 1));
all.add(edit, new Rectangle(2, 0, 1, 1));
all.add(remove, new Rectangle(3, 0, 1, 1));
all.add(proxy, new Rectangle(2, 1, 1, 1));
all.add(separator, new Rectangle(0, 2, 5, 1));
return all;
}
示例6: setupGUI
import javax.swing.JSeparator; //导入方法依赖的package包/类
@SuppressWarnings("nls")
private void setupGUI()
{
JPanel all = new JPanel();
allowNonSequential = new JCheckBox(
getString("wizard.editor.allowNonSequential.label"));
showPageTitlesNextPrev = new JCheckBox(
getString("wizard.editor.showPageTitlesNextPrev.label"));
JLabel cssLabel = new JLabel(
getString("wizard.editor.additionalCssClass.label"));
additionalCssClass = new JTextField();
JLabel cssHelp = new JLabel(
getString("wizard.editor.additionalCssClass.help"));
cssHelp.setFont(all.getFont());
accessibilityHelpTitle = new JLabel(
getString("wizard.editor.accesshelp.title"));
accessibilityHelp = new JTextArea(
getString("wizard.editor.accesshelp.text"));
accessibilityHelp.setEditable(false);
accessibilityHelp.setBackground(all.getBackground());
accessibilityHelp.setFont(all.getFont());
JSeparator separator1 = new JSeparator();
JSeparator separator2 = new JSeparator();
int sh = separator1.getPreferredSize().height;
final int columns[] = {cssLabel.getPreferredSize().width, TableLayout.FILL};
final int rows[] = {allowNonSequential.getPreferredSize().height,
showPageTitlesNextPrev.getPreferredSize().height, sh, additionalCssClass.getPreferredSize().height,
cssHelp.getPreferredSize().height, sh, accessibilityHelpTitle.getPreferredSize().height,
accessibilityHelp.getPreferredSize().height};
all.setLayout(new TableLayout(rows, columns, 5, 5));
all.add(allowNonSequential, new Rectangle(0, 0, 2, 1));
all.add(showPageTitlesNextPrev, new Rectangle(0, 1, 2, 1));
all.add(separator1, new Rectangle(0, 2, 2, 1));
all.add(cssLabel, new Rectangle(0, 3, 1, 1));
all.add(additionalCssClass, new Rectangle(1, 3, 1, 1));
all.add(cssHelp, new Rectangle(0, 4, 2, 1));
all.add(separator2, new Rectangle(0, 5, 2, 1));
all.add(accessibilityHelpTitle, new Rectangle(0, 6, 2, 1));
all.add(accessibilityHelp, new Rectangle(0, 7, 2, 1));
addSection(all);
}