javax.swing.JComponent#setLayout ( )源码实例Demo

下面列出了javax.swing.JComponent#setLayout ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: DefaultPlugin.java
/**
 */
private static JComponent wrapDialogContent(JComponent comp,
                                            boolean selfResizing) {
    JComponent result;
    
    if ((comp.getBorder() != null) || selfResizing) {
        result = selfResizing ? new SelfResizingPanel() : new JPanel();
        result.setLayout(new GridLayout());
        result.add(comp);
    } else {
        result = comp;
    }
    result.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
    result.getAccessibleContext().setAccessibleDescription(bundle.getString("AD_title_select_generator"));
    return result;
}
 
源代码2 项目: LoboBrowser   文件: SearchDialog.java
public SearchDialog(final Frame owner, final boolean modal, final String keywordsTooltip) throws HeadlessException {
  super(owner, modal);
  this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  this.tagsField.setToolTip(keywordsTooltip);
  final Container contentPane = this.getContentPane();
  contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
  final FormPanel fieldsPanel = new FormPanel();
  fieldsPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  fieldsPanel.addField(this.tagsField);
  contentPane.add(fieldsPanel);
  final JComponent buttonsPanel = new JPanel();
  buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS));
  final JButton okButton = new JButton();
  okButton.setAction(new OkAction());
  okButton.setText("Search");
  final JButton cancelButton = new JButton();
  cancelButton.setAction(new CancelAction());
  cancelButton.setText("Cancel");
  buttonsPanel.add(Box.createHorizontalGlue());
  buttonsPanel.add(okButton);
  buttonsPanel.add(Box.createRigidArea(new Dimension(4, 1)));
  buttonsPanel.add(cancelButton);
  buttonsPanel.add(Box.createHorizontalGlue());
  contentPane.add(buttonsPanel);
  contentPane.add(Box.createRigidArea(new Dimension(1, 4)));
}
 
源代码3 项目: netbeans   文件: ViewModelListener.java
ViewModelListener(
    String viewType,
    JComponent view,
    JComponent buttonsPane,
    String propertiesHelpID,
    Image viewIcon
) {
    this.viewType = viewType;
    this.view = view;
    this.buttonsPane = buttonsPane;
    buttonsPane.setLayout(new GridBagLayout());
    this.propertiesHelpID = propertiesHelpID;
    this.viewIcon = viewIcon;
    initView();
    setUp();
}
 
源代码4 项目: netbeans   文件: EmptyTestStepLocation.java
private Component createVisualComp() {
    JCheckBox[] chkBoxes;
    
    JComponent optCode = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptCode"),               //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_SETUP,
                    GuiUtils.CHK_TEARDOWN,
                    GuiUtils.CHK_BEFORE_CLASS,
                    GuiUtils.CHK_AFTER_CLASS}));
    chkSetUp = chkBoxes[0];
    chkTearDown = chkBoxes[1];
    chkBeforeClass = chkBoxes[2];
    chkAfterClass = chkBoxes[3];
    
    JComponent optComments = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptComments"),           //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_HINTS}));
    chkCodeHints = chkBoxes[0];

    JComponent box = new SelfResizingPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
    box.add(optCode);
    box.add(Box.createHorizontalStrut(18));
    box.add(optComments);

    /* tune layout of the components within the box: */
    optCode.setAlignmentY(0.0f);
    optComments.setAlignmentY(0.0f);

    return box;
}
 
源代码5 项目: netbeans   文件: AbstractViewTabDisplayerUI.java
@Override
public void installUI(JComponent c) {
    super.installUI(c);
    ToolTipManager.sharedInstance().registerComponent(displayer);
    controller = createController();
    dataModel = displayer.getModel();
    dataModel.addChangeListener (controller);
    dataModel.addComplexListDataListener(controller);
    layoutModel = createLayoutModel();
    if( !Boolean.getBoolean("winsys.non_stretching_view_tabs") && !isUseStretchingTabs() ) {
        btnMinimizeMode = TabControlButtonFactory.createSlideGroupButton( displayer );
        c.setLayout( new PinButtonLayout() );
    }
    displayer.addPropertyChangeListener (controller);
    selectionModel.addChangeListener (controller);
    displayer.addMouseListener(controller);
    displayer.addMouseMotionListener(controller);
    installControlButtons();
    dataModel.addChangeListener( new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            showHideControlButtons();
            if( null != dataModel )
                dataModel.removeChangeListener( this );
        }
    });
    showHideControlButtons();
}
 
源代码6 项目: netbeans   文件: GroovyJUnitTestWizard.java
private static JComponent wrapDialogContent(JComponent comp) {
    JComponent result;

    result = new SelfResizingPanel();
    result.setLayout(new GridLayout());
    result.add(comp);
    result.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
    result.getAccessibleContext().setAccessibleDescription(BUNDLE.getString("AD_title_select_generator")); //NOI18N
    return result;
}
 
源代码7 项目: stendhal   文件: CreatureAnimationPreview.java
private CreatureAnimationPreview() {
	jFrame.setSize(new Dimension(818, 470));
	JScrollPane scroll = new JScrollPane();
	scroll.setViewportView(createJTree());
	split.setLeftComponent(scroll);

	JPanel rightPanel = new JPanel();
	JComponent row = new JComponent() {};
	row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
	rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));

	for (int i = 0; i < NUMBER_OF_ROWS; i++) {
		JLabel l = new JLabel();
		animationPanel[i] = l;
		animations[i] = new AnimationRunner(l);
		row.add(l);
	}

	rightPanel.add(row);
	rightPanel.add(mainPanel);

	split.setRightComponent(rightPanel);
	jFrame.setContentPane(split);
	jFrame.setTitle("animated Monsters test");
	jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	jFrame.setVisible(true);
}
 
源代码8 项目: pumpernickel   文件: XPOpenLocationPaneUI.java
@Override
protected void installGUI(JComponent comp) {
	comp.removeAll();
	comp.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 0;
	c.weighty = 0;
	c.anchor = GridBagConstraints.EAST;
	c.insets = new Insets(5, 5, 5, 5);
	comp.add(new JLabel("Look In:"), c);
	c.gridx++;
	c.weightx = 1;
	c.fill = GridBagConstraints.HORIZONTAL;
	comp.add(new XPDirectoryControls(this), c);

	c.gridy++;
	c.gridx = 0;
	c.weightx = 0;
	c.fill = GridBagConstraints.BOTH;
	c.gridheight = GridBagConstraints.REMAINDER;
	JPanel sidebar = new JPanel();
	sidebar.setBackground(Color.lightGray);
	sidebar.setOpaque(true);
	comp.add(sidebar, c);

	c.gridx++;
	c.fill = GridBagConstraints.BOTH;
	c.weighty = 1;
	c.weightx = 1;
	c.gridheight = 1;
	comp.add(browser, c);

	c.gridy++;
	c.weighty = 0;
	comp.add(new FileControls(), c);
}
 
源代码9 项目: astor   文件: ConstantVoltageExample.java
public static JComponent createComponent() {
    JComponent container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.LINE_AXIS));
    
    Chart chart1 = createChart("Voltage", 550, 450, LegendPosition.InsideNE, true);
    Chart chart2 = createChart("Error Covariance", 450, 450, LegendPosition.InsideNE, false);
    
    constantVoltageTest(chart1, chart2);

    container.add(new XChartPanel(chart1));
    container.add(new XChartPanel(chart2));
    
    container.setBorder(BorderFactory.createLineBorder(Color.black, 1));
    return container;
}
 
源代码10 项目: pumpernickel   文件: TileLocationBrowserUI.java
@Override
protected void installGUI(JComponent comp) {
	comp.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 1;
	c.fill = GridBagConstraints.NONE;
	c.anchor = GridBagConstraints.CENTER;
	c.fill = GridBagConstraints.BOTH;
	comp.add(scrollPane, c);
}
 
源代码11 项目: astor   文件: CannonballExample.java
public static JComponent createComponent() {
    JComponent container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS));

    Chart chart = createChart("Cannonball", LegendPosition.InsideNE);
    cannonballTest(chart);
    container.add(new XChartPanel(chart));
    
    container.setBorder(BorderFactory.createLineBorder(Color.black, 1));
    return container;
}
 
源代码12 项目: astor   文件: ConstantVoltageExample.java
public static JComponent createComponent() {
    JComponent container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.LINE_AXIS));
    
    Chart chart1 = createChart("Voltage", 550, 450, LegendPosition.InsideNE, true);
    Chart chart2 = createChart("Error Covariance", 450, 450, LegendPosition.InsideNE, false);
    
    constantVoltageTest(chart1, chart2);

    container.add(new XChartPanel(chart1));
    container.add(new XChartPanel(chart2));
    
    container.setBorder(BorderFactory.createLineBorder(Color.black, 1));
    return container;
}
 
源代码13 项目: stendhal   文件: SBoxLayout.java
/**
 * A convenience method for creating a container using SBoxLayout.
 *
 * @param direction layout direction
 * @return A component using SBoxLayout
 */
public static JComponent createContainer(boolean direction) {
	JComponent container = new Spring();
	container.setLayout(new SBoxLayout(direction));

	return container;
}
 
源代码14 项目: netbeans   文件: TestSuiteStepLocation.java
private Component createVisualComp() {
    JCheckBox[] chkBoxes;
    
    JComponent infoLabel = GuiUtils.createMultilineLabel(
            NbBundle.getMessage(TestSuiteStepLocation.class,
                                "TXT_ClassesInSuite"));             //NOI18N
    JComponent optCode = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptCode"),               //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_SETUP,
                    GuiUtils.CHK_TEARDOWN,
                    GuiUtils.CHK_BEFORE_CLASS,
                    GuiUtils.CHK_AFTER_CLASS}));
    chkSetUp = chkBoxes[0];
    chkTearDown = chkBoxes[1];
    chkBeforeClass = chkBoxes[2];
    chkAfterClass = chkBoxes[3];
    
    JComponent optComments = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptComments"),           //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_HINTS}));
    chkCodeHints = chkBoxes[0];

    JComponent bottomPanel = new SelfResizingPanel();
    bottomPanel.setLayout(new BorderLayout(0, 24));
    bottomPanel.add(infoLabel, BorderLayout.NORTH);
    JComponent box = new JPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
    box.add(optCode);
    box.add(Box.createHorizontalStrut(18));
    box.add(optComments);
    bottomPanel.add(box, BorderLayout.CENTER);
    
    /* tune layout of the components within the box: */
    infoLabel.setAlignmentX(0.0f);
    optCode.setAlignmentY(0.0f);
    optComments.setAlignmentY(0.0f);
 
    return bottomPanel;
}
 
源代码15 项目: pentaho-reporting   文件: PreviewFrame.java
protected void init() {
  addComponentListener( new RequestFocusHandler() );

  messages =
      new Messages( getLocale(), SwingPreviewModule.BUNDLE_NAME, ObjectUtilities
          .getClassLoader( SwingPreviewModule.class ) );
  previewPane = new PreviewPane();
  previewPane.setDeferredRepagination( true );
  addComponentListener( new TriggerPaginationListener( previewPane ) );
  statusBar = new JStatusBar( previewPane.getIconTheme() );

  pageLabel = new JLabel();
  previewPane.addPropertyChangeListener( new PreviewPanePropertyChangeHandler() );

  final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig();
  final boolean progressBarEnabled = "true".equals( configuration //$NON-NLS-1$
      .getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.base.ProgressBarEnabled" ) ); //$NON-NLS-1$
  final boolean progressDialogEnabled = "true".equals( configuration //$NON-NLS-1$
      .getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.base.ProgressDialogEnabled" ) ); //$NON-NLS-1$

  if ( progressBarEnabled ) {
    progressBar = new ReportProgressBar();
    progressBar.setVisible( false );
    previewPane.addReportProgressListener( progressBar );
    previewPane.addPropertyChangeListener( new PreviewPanePropertyChangeHandler() );
  } else {
    progressBar = null;
  }

  if ( progressDialogEnabled ) {
    progressDialog = new ReportProgressDialog( this );
    final MasterReport reportJob = previewPane.getReportJob();
    if ( reportJob == null || reportJob.getTitle() == null ) {
      progressDialog.setTitle( messages.getString( "ProgressDialog.EMPTY_TITLE" ) );
      progressDialog.setMessage( messages.getString( "ProgressDialog.EMPTY_TITLE" ) );
    } else {
      progressDialog.setTitle( messages.getString( "ProgressDialog.TITLE", reportJob.getTitle() ) );
      progressDialog.setMessage( messages.getString( "ProgressDialog.TITLE", reportJob.getTitle() ) );
    }
    progressDialog.pack();
  } else {
    progressDialog = null;
  }

  final JComponent extensionArea = statusBar.getExtensionArea();
  extensionArea.setLayout( new BoxLayout( extensionArea, BoxLayout.X_AXIS ) );
  if ( progressBar != null ) {
    extensionArea.add( progressBar );
  }
  extensionArea.add( pageLabel );

  final JComponent contentPane = new JPanel();
  contentPane.setLayout( new BorderLayout() );
  contentPane.add( previewPane, BorderLayout.CENTER );
  contentPane.add( statusBar, BorderLayout.SOUTH );
  setContentPane( contentPane );

  updateMenu( previewPane.getMenu() );
  setTitle( previewPane.getTitle() );
  statusBar.setIconTheme( previewPane.getIconTheme() );
  statusBar.setStatus( previewPane.getStatusType(), previewPane.getStatusText() );
}
 
源代码16 项目: pentaho-reporting   文件: PreviewDialog.java
protected void init() {
  setDefaultCloseOperation( JDialog.DISPOSE_ON_CLOSE );

  addComponentListener( new RequestFocusHandler() );
  messages =
      new Messages( getLocale(), SwingPreviewModule.BUNDLE_NAME, ObjectUtilities
          .getClassLoader( SwingPreviewModule.class ) );

  previewPane = new PreviewPane();
  previewPane.setDeferredRepagination( true );
  addComponentListener( new TriggerPaginationListener( previewPane ) );

  statusBar = new JStatusBar( previewPane.getIconTheme() );

  pageLabel = new JLabel();

  final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig();
  final boolean progressBarEnabled = "true".equals( configuration //$NON-NLS-1$
      .getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.base.ProgressBarEnabled" ) ); //$NON-NLS-1$
  final boolean progressDialogEnabled = "true".equals( configuration //$NON-NLS-1$
      .getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.base.ProgressDialogEnabled" ) ); //$NON-NLS-1$

  if ( progressBarEnabled ) {
    progressBar = new ReportProgressBar();
    progressBar.setVisible( false );
    previewPane.addReportProgressListener( progressBar );
    previewPane.addPropertyChangeListener( new PreviewPanePropertyChangeHandler() );
  } else {
    progressBar = null;
  }

  if ( progressDialogEnabled ) {
    progressDialog = new ReportProgressDialog( this );
    final MasterReport reportJob = previewPane.getReportJob();
    if ( reportJob == null || reportJob.getTitle() == null ) {
      progressDialog.setTitle( messages.getString( "ProgressDialog.EMPTY_TITLE" ) );
      progressDialog.setMessage( messages.getString( "ProgressDialog.EMPTY_TITLE" ) );
    } else {
      progressDialog.setTitle( messages.getString( "ProgressDialog.TITLE", reportJob.getTitle() ) );
      progressDialog.setMessage( messages.getString( "ProgressDialog.TITLE", reportJob.getTitle() ) );
    }
    progressDialog.pack();
  } else {
    progressDialog = null;
  }

  final JComponent extensionArea = statusBar.getExtensionArea();
  extensionArea.setLayout( new BoxLayout( extensionArea, BoxLayout.X_AXIS ) );
  if ( progressBar != null ) {
    extensionArea.add( progressBar );
  }
  extensionArea.add( pageLabel );

  final JComponent contentPane = new JPanel();
  contentPane.setLayout( new BorderLayout() );
  contentPane.add( previewPane, BorderLayout.CENTER );
  contentPane.add( statusBar, BorderLayout.SOUTH );
  setContentPane( contentPane );

  updateMenu( previewPane.getMenu() );
  setTitle( previewPane.getTitle() );
  statusBar.setIconTheme( previewPane.getIconTheme() );
  statusBar.setStatus( previewPane.getStatusType(), previewPane.getStatusText() );
}
 
源代码17 项目: pumpernickel   文件: AquaOpenLocationPaneUI.java
@Override
protected void installGUI(JComponent panel) {
	panel.addPropertyChangeListener(KEY_INCLUDE_SIDEBAR,
			propertyChangeListener);

	if (sourceList.isEmpty()) {
		File[] array1 = CommonFiles.getUserDirectories(true);
		IOLocation[] array2 = new FileLocation[array1.length];
		for (int a = 0; a < array1.length; a++) {
			array2[a] = LocationFactory.get().create(array1[a]);
		}
		sourceList.add(array2);
	}

	boolean includeSidebar = getBoolean(locationPane, KEY_INCLUDE_SIDEBAR,
			true);
	boolean includeFooter = getBoolean(locationPane, KEY_INCLUDE_FOOTER,
			true);

	panel.removeAll();
	panel.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.insets = new Insets(4, 0, 4, 0);
	panel.add(controls, c);
	c.gridy++;
	c.weighty = 1;
	c.fill = GridBagConstraints.BOTH;

	if (includeSidebar) {
		splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
				sourceListScrollPane, browser);
		panel.add(splitPane, c);
	} else {
		panel.add(browser, c);
	}

	if (includeFooter) {
		c.weighty = 0;
		c.gridy++;
		panel.add(footer, c);
	}
	sourceListScrollPane.setMinimumSize(new Dimension(100, 40));
	sourceListScrollPane.setPreferredSize(new Dimension(150, 40));
}
 
源代码18 项目: openchemlib-js   文件: JTextDrawingObjectDialog.java
private void init(Component owner) {
      mComboBoxTextSize = new JComboBox(TEXT_SIZE_LIST);
mComboBoxTextSize.setEditable(true);
mComboBoxTextSize.setSelectedItem(""+(int)mTextObject.getSize());

      mComboBoxStyle = new JComboBox(TEXT_STYLE_LIST);
int styleIndex = 0;
for (int i=0; i<TEXT_STYLE.length; i++) {
	if (mTextObject.getStyle() == TEXT_STYLE[i]) {
		styleIndex = i;
		break;
		}
	}
mComboBoxStyle.setSelectedIndex(styleIndex);

JComponent menuPanel = new JPanel();
double[][] size = { { 8, TableLayout.PREFERRED, 4, TableLayout.PREFERRED, 8 },
					{ 8, TableLayout.PREFERRED, 4, TableLayout.PREFERRED, 8 } };
menuPanel.setLayout(new TableLayout(size));

menuPanel.add(new JLabel("Text size:"), "1,1");
menuPanel.add(mComboBoxTextSize, "3,1");
menuPanel.add(new JLabel("Text style:"), "1,3");
menuPanel.add(mComboBoxStyle, "3,3");

mTextArea = new JTextArea(mTextObject.getText(), 3, 20);
      mTextArea.setBorder(BorderFactory.createEtchedBorder());
JPanel textPanel = new JPanel();
      textPanel.setBorder(BorderFactory.createEmptyBorder(0,4,0,4));
textPanel.add(mTextArea);

JButton buttonOK = new JButton("OK");
buttonOK.addActionListener(this);
JButton buttonCancel = new JButton("Cancel");
buttonCancel.addActionListener(this);
JPanel innerButtonPanel = new JPanel();
      innerButtonPanel.setLayout(new GridLayout(1,2,8,0));
      innerButtonPanel.add(buttonCancel);
      innerButtonPanel.add(buttonOK);
      innerButtonPanel.setBorder(BorderFactory.createEmptyBorder(8,8,8,8));
JPanel buttonPanel = new JPanel();
      buttonPanel.setLayout(new BorderLayout());
      buttonPanel.add(innerButtonPanel, BorderLayout.EAST);

getContentPane().setLayout(new BorderLayout());
getContentPane().add(menuPanel,  BorderLayout.NORTH);
getContentPane().add(textPanel,  BorderLayout.CENTER);
getContentPane().add(buttonPanel,  BorderLayout.SOUTH);

getRootPane().setDefaultButton(buttonOK);

pack();
setLocationRelativeTo(owner);

mTextArea.requestFocus();
setVisible(true);
}
 
源代码19 项目: stendhal   文件: SwingClientGUI.java
private void setupOverallLayout() {
	Dimension displaySize = stendhal.getDisplaySize();
	Container windowContent = SBoxLayout.createContainer(SBoxLayout.HORIZONTAL);
	frame.setContentPane(windowContent);

	// Set maximum size to prevent the entry requesting massive widths, but
	// force expand if there's extra space anyway
	chatText.getPlayerChatText().setMaximumSize(new Dimension(displaySize.width, Integer.MAX_VALUE));
	JComponent chatEntryBox = SBoxLayout.createContainer(SBoxLayout.HORIZONTAL);
	chatEntryBox.add(chatText.getPlayerChatText(), SLayout.EXPAND_X);

	if (Testing.CHAT) {
		chatEntryBox.add(new CharacterMap(chatText.getPlayerChatText()));
	}
	final JComponent chatBox = new JPanel();
	chatBox.setBorder(null);
	chatBox.setLayout(new SBoxLayout(SBoxLayout.VERTICAL));
	chatBox.add(chatEntryBox, SLayout.EXPAND_X);
	chatBox.add(chatLogArea, SBoxLayout.constraint(SLayout.EXPAND_X, SLayout.EXPAND_Y));

	verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pane, chatBox);
	verticalSplit.setBorder(null);

	/*
	 * Fix the container panel size, so that it is always visible
	 */
	containerPanel.setMinimumSize(containerPanel.getPreferredSize());

	leftColumn.setMinimumSize(new Dimension());
	// Splitter between the left column and game screen
	JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftColumn, verticalSplit);
	// Ensure that the limits are obeyed even when the component is resized
	split.addComponentListener(new HorizontalSplitListener(displaySize, split));

	horizontalSplit = split;
	int divWidth = verticalSplit.getDividerSize();
	pane.setPreferredSize(new Dimension(displaySize.width + divWidth, displaySize.height));
	horizontalSplit.setBorder(null);
	windowContent.add(horizontalSplit, SBoxLayout.constraint(SLayout.EXPAND_Y, SLayout.EXPAND_X));

	JComponent rightSidePanel = SBoxLayout.createContainer(SBoxLayout.VERTICAL);
	JComponent settings = new SettingsPanel();
	rightSidePanel.add(settings, SLayout.EXPAND_X);
	rightSidePanel.add(containerPanel, SBoxLayout.constraint(SLayout.EXPAND_Y, SLayout.EXPAND_X));
	windowContent.add(rightSidePanel, SLayout.EXPAND_Y);

	frame.pack();
	horizontalSplit.setDividerLocation(leftColumn.getPreferredSize().width);

	smallScreenHacks();
}
 
源代码20 项目: stendhal   文件: SBoxLayout.java
/**
 * A convenience method for creating a container using SBoxLayout with
 * padding between the components.
 *
 * @param direction layout direction
 * @param padding padding in pixels between the components
 * @return A component using SBoxLayout
 */
public static JComponent createContainer(boolean direction, int padding) {
	JComponent container = new Spring();
	container.setLayout(new SBoxLayout(direction, padding));

	return container;
}