Java Code Examples for javax.swing.Box#setBorder()

The following examples show how to use javax.swing.Box#setBorder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectionSettingsUI.java    From LoboBrowser with MIT License 6 votes vote down vote up
private Component getProxyHostArea() {
  final Box checkBoxBox = new Box(BoxLayout.Y_AXIS);
  checkBoxBox.setPreferredSize(new Dimension(600, 200));
  checkBoxBox.add(this.bypassLocalCheckBox);
  checkBoxBox.add(this.authenticatedCheckBox);

  final Box checkBoxBoxExpander = new Box(BoxLayout.X_AXIS);
  checkBoxBoxExpander.add(checkBoxBox);
  checkBoxBoxExpander.add(Box.createHorizontalGlue());

  final Box box = this.proxyHostArea;
  box.setBorder(new EmptyBorder(8, 16, 8, 8));
  box.add(this.hostPortPanel);
  box.add(checkBoxBoxExpander);
  box.add(this.authenticationPanel);
  return box;
}
 
Example 2
Source File: FrameDemo.java    From littleluck with Apache License 2.0 6 votes vote down vote up
protected JComponent createControlPanel() {
    Box controlPanel = Box.createVerticalBox();
    controlPanel.setBorder(new EmptyBorder(8, 8, 8, 8));

    // Create button to control visibility of frame
    JButton showButton = new JButton("Show JFrame...");
    showButton.addActionListener(new ShowActionListener());
    controlPanel.add(showButton);

    // Create checkbox to control busy state of frame
    JCheckBox busyCheckBox = new JCheckBox("Frame busy");
    busyCheckBox.setSelected(false);
    busyCheckBox.addChangeListener(new BusyChangeListener());
    controlPanel.add(busyCheckBox);

    return controlPanel;
}
 
Example 3
Source File: ExportDialog.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void initLayout()
{
	Container contentPane = getContentPane();
	contentPane.setLayout(new BorderLayout());

	Box topPanel = Box.createHorizontalBox();
	topPanel.add(new JLabel("Select Character:"));
	topPanel.add(Box.createHorizontalStrut(5));
	topPanel.add(characterBox);
	topPanel.add(Box.createHorizontalStrut(5));
	topPanel.add(partyBox);
	topPanel.add(Box.createHorizontalGlue());
	topPanel.add(Box.createHorizontalStrut(50));
	topPanel.add(new JLabel("Export to:"));
	topPanel.add(Box.createHorizontalStrut(5));
	topPanel.add(exportBox);
	contentPane.add(topPanel, BorderLayout.NORTH);

	JScrollPane scrollPane = new JScrollPane(fileList);
	scrollPane.setBorder(
		BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Templates"), scrollPane.getBorder()));
	contentPane.add(scrollPane, BorderLayout.CENTER);

	Box bottomPanel = Box.createHorizontalBox();
	bottomPanel.add(progressBar);
	bottomPanel.add(Box.createHorizontalGlue());
	bottomPanel.add(Box.createHorizontalStrut(5));
	bottomPanel.add(exportButton);
	bottomPanel.add(Box.createHorizontalStrut(5));
	bottomPanel.add(closeButton);
	contentPane.add(bottomPanel, BorderLayout.SOUTH);

	topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	bottomPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	pack();
}
 
Example 4
Source File: TableEditor.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected JComponent buildPanel() {
	Box box = Box.createVerticalBox();
	Container tablePanel = createTablePanel(); 
	box.add(tablePanel);
	box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	return box;
}
 
Example 5
Source File: SourceSelectionDialog.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void initComponents()
{
	Container pane = getContentPane();
	pane.setLayout(new BorderLayout());

	tabs.add(LanguageBundle.getString("in_basic"), basicPanel); //$NON-NLS-1$
	tabs.add(LanguageBundle.getString("in_advanced"), advancedPanel); //$NON-NLS-1$
	tabs.addChangeListener(this);
	pane.add(tabs, BorderLayout.CENTER);

	loadButton.setDefaultCapable(true);
	getRootPane().setDefaultButton(loadButton);

	loadButton.setActionCommand(LOAD_COMMAND);
	cancelButton.setActionCommand(CANCEL_COMMAND);
	deleteButton.setActionCommand(DELETE_COMMAND);
	saveButton.setActionCommand(SAVE_COMMAND);
	installDataButton.setActionCommand(INSTALLDATA_COMMAND);

	loadButton.addActionListener(this);
	cancelButton.addActionListener(this);
	saveButton.addActionListener(this);
	deleteButton.addActionListener(this);
	installDataButton.addActionListener(this);

	Box buttons = Box.createHorizontalBox();
	buttons.add(buttonPanel);
	buttons.add(Box.createHorizontalGlue());
	buttons.add(installDataButton);
	buttons.add(Box.createHorizontalGlue());
	buttons.add(loadButton);
	buttons.add(Box.createHorizontalStrut(5));
	buttons.add(cancelButton);
	buttons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	pane.add(buttons, BorderLayout.SOUTH);

	Utility.installEscapeCloseOperation(this);
}
 
Example 6
Source File: ItemEditorDialog.java    From LoboBrowser with MIT License 5 votes vote down vote up
private Component createButtonPanel() {
  final Box panel = new Box(BoxLayout.X_AXIS);
  // panel.setBorder(new BevelBorder(BevelBorder.LOWERED));
  panel.setBorder(new EmptyBorder(4, 4, 4, 4));
  panel.add(Box.createGlue());
  panel.add(this.okButton);
  panel.add(Box.createRigidArea(new Dimension(4, 1)));
  panel.add(this.cancelButton);
  panel.add(Box.createGlue());
  return panel;
}
 
Example 7
Source File: TrackerCountReader.java    From tracker with GNU General Public License v3.0 5 votes vote down vote up
private Component leftJustify(Component c)  {
   Box  b = Box.createHorizontalBox();
   b.add( c );
   b.add( Box.createHorizontalGlue() );
   b.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
   return b;
}
 
Example 8
Source File: StatusPanel.java    From swift-explorer with Apache License 2.0 5 votes vote down vote up
public StatusPanel(SwiftOperations ops, SwiftCallback callback) {
    super(new BorderLayout(0, 0));
    this.ops = ops;
    this.callback = callback;
    Box left = Box.createHorizontalBox();
    Box center = Box.createHorizontalBox();
    Box right = Box.createHorizontalBox();
    left.setBorder(BorderFactory.createEtchedBorder());
    right.setBorder(BorderFactory.createEtchedBorder());
    center.setBorder(BorderFactory.createEtchedBorder());
    center.setPreferredSize(new Dimension(320, 24));
    left.setPreferredSize(new Dimension(256, 24));
    //
    busyLabel = new JLabel();
    busyLabel.setPreferredSize(new Dimension(18, 18));
    right.add(busyLabel);
    //
    callCountLabel = new JLabel();
    callCountLabel.setPreferredSize(new Dimension(64, 18));
    right.add(Box.createHorizontalStrut(4));
    right.add(callCountLabel);
    right.add(Box.createHorizontalStrut(4));
    //
    this.add(left, BorderLayout.WEST);
    this.add(center, BorderLayout.CENTER);
    this.add(right, BorderLayout.EAST);
    //
    leftLabel = new JLabel("");
    left.add(Box.createHorizontalStrut(4));
    left.add(leftLabel);
    left.add(Box.createHorizontalStrut(8));
    //
    rightLabel = new JLabel("");
    center.add(Box.createHorizontalStrut(8));
    center.add(rightLabel);
    center.add(Box.createHorizontalStrut(4));
}
 
Example 9
Source File: SourceSelectionDialog.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void initComponents()
{
	Container pane = getContentPane();
	pane.setLayout(new BorderLayout());

	tabs.add(LanguageBundle.getString("in_basic"), basicPanel); //$NON-NLS-1$
	tabs.add(LanguageBundle.getString("in_advanced"), advancedPanel); //$NON-NLS-1$
	tabs.addChangeListener(this);
	pane.add(tabs, BorderLayout.CENTER);

	loadButton.setDefaultCapable(true);
	getRootPane().setDefaultButton(loadButton);

	loadButton.setActionCommand(LOAD_COMMAND);
	cancelButton.setActionCommand(CANCEL_COMMAND);
	deleteButton.setActionCommand(DELETE_COMMAND);
	saveButton.setActionCommand(SAVE_COMMAND);
	installDataButton.setActionCommand(INSTALLDATA_COMMAND);

	loadButton.addActionListener(this);
	cancelButton.addActionListener(this);
	saveButton.addActionListener(this);
	deleteButton.addActionListener(this);
	installDataButton.addActionListener(this);

	Box buttons = Box.createHorizontalBox();
	buttons.add(buttonPanel);
	buttons.add(Box.createHorizontalGlue());
	buttons.add(installDataButton);
	buttons.add(Box.createHorizontalGlue());
	buttons.add(loadButton);
	buttons.add(Box.createHorizontalStrut(5));
	buttons.add(cancelButton);
	buttons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	pane.add(buttons, BorderLayout.SOUTH);

	Utility.installEscapeCloseOperation(this);
}
 
Example 10
Source File: ListChooser.java    From osp with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Allows the user to choose from the supplied list. Items not selected are
 * removed from the list.
 *
 * @param choices a collection of objects to choose from
 * @param names an optional collection of descriptive names
 * @param values an optional collection of values
 * @param descriptions an optional collection of descriptions
 * @param selected an array of initially selected states
 * @param disabled an array of disabled states (true = disabled)
 * @return <code>true</code> if OK button was clicked
 */
public boolean choose(Collection<?> choices, Collection<String> names, Collection<?> values, Collection<String> descriptions, boolean[] selected, boolean[] disabled) {
  checkPane.removeAll();
  checkBoxes = new JCheckBox[choices.size()];
  selections = new boolean[choices.size()];
  objects = new Object[choices.size()];
  ArrayList<String> nameList = new ArrayList<String>();
  if(names!=null) {
    nameList.addAll(names);
  }
  ArrayList<Object> valueList = new ArrayList<Object>();
  if(values!=null) {
    valueList.addAll(values);
  }
  ArrayList<String> descriptionList = new ArrayList<String>();
  if(descriptions!=null) {
  	descriptionList.addAll(descriptions);
  }
  Iterator<?> it = choices.iterator();
  int i = 0;
  while(it.hasNext()) {
    objects[i] = it.next();
    selections[i] = false;
    if((nameList.size()<=i)||(nameList.get(i)==null)) {
      checkBoxes[i] = new JCheckBox(objects[i].toString());
    } else {
      String text = nameList.get(i);
      if (valueList.size()>i && valueList.get(i)!=null) {
        text += separator+valueList.get(i);
      }
      checkBoxes[i] = new JCheckBox(text);
    }
    checkBoxes[i].setSelected(selected[i]);
    checkBoxes[i].setEnabled(!disabled[i]);
    checkBoxes[i].setBackground(Color.white);
    checkBoxes[i].setFont(lightFont);
    checkBoxes[i].setIconTextGap(10);

    Box box = Box.createHorizontalBox();
    box.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 8));
    box.add(checkBoxes[i]);
    box.add(Box.createHorizontalGlue());
    checkPane.add(box);

    if (descriptionList.size()>i && descriptionList.get(i)!=null) {
     JLabel label = new JLabel(descriptionList.get(i));
    	label.setFont(lightFont);
    	box.add(label);
    }

    i++;
  }
  FontSizer.setFonts(this, FontSizer.getLevel());
  this.pack();
  setVisible(true);
  if(!applyChanges) {
    return false;
  }
  for(i = 0; i<objects.length; i++) {
    if(!selections[i]) {
      choices.remove(objects[i]);
    }
  }
  return true;
}
 
Example 11
Source File: AboutDialog.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new AboutDialog.
 */
public AboutDialog() {
	super( "about.title", new Object[] { Consts.APPLICATION_NAME } );
	
	final Box box = Box.createVerticalBox();
	box.setBorder( BorderFactory.createEmptyBorder( 15, 20, 15, 10 ) );
	
	box.add( GuiUtils.wrapInPanel( GeneralUtils.createAnimatedLogoLabel() ) );
	
	box.add( Box.createVerticalStrut( 10 ) );
	
	box.add( GuiUtils.wrapInPanel( new JLabel( Language.getText( "about.usedIcons", Consts.APPLICATION_NAME + "â„¢" ) ) ) );
	box.add( Box.createVerticalStrut( 5 ) );
	box.add( GuiUtils.wrapInPanel( new JLabel( Language.getText( "about.sc2ImagesCopyrightCompany", "© Blizzard Entertainment, Inc." ) ) ) );
	box.add( Box.createVerticalStrut( 15 ) );
	box.add( new JPanel( new BorderLayout() ) );
	box.add( GuiUtils.wrapInPanel( GuiUtils.changeFontToBold( new JLabel( Language.getText( "about.elapsedTimeSinceStart", Consts.APPLICATION_NAME, GeneralUtils.formatLongSeconds( ( System.currentTimeMillis() - MainFrame.APPLICATION_START_TIME.getTime() ) / 1000 ) ) ) ) ) );
	box.add( new JPanel( new BorderLayout() ) );
	box.add( Box.createVerticalStrut( 15 ) );
	box.add( GuiUtils.wrapInPanel( new JLabel( Language.getText( "welcome.thankYou", Consts.APPLICATION_NAME + "â„¢" ) ) ) );
	box.add( Box.createVerticalStrut( 10 ) );
	final JLabel copyrightLabel = new JLabel( "Copyright © " + Language.formatPersonName( Consts.AUTHOR_FIRST_NAME, Consts.AUTHOR_LAST_NAME ) + ", 2010-2014" );
	GuiUtils.changeFontToItalic( copyrightLabel );
	box.add( GuiUtils.wrapInPanel( copyrightLabel ) );
	box.add( Box.createVerticalStrut( 10 ) );
	box.add( GuiUtils.wrapInPanel( new JLabel( Consts.APPLICATION_NAME + " is a trademark of " + Language.formatPersonName( Consts.AUTHOR_FIRST_NAME, Consts.AUTHOR_LAST_NAME ) + "." ) ) );
	//box.add( new JSeparator() );
	box.add( Box.createVerticalStrut( 10 ) );
	
	final JLabel visitScelightLabel = GeneralUtils.createLinkLabel( "Visit Scelightâ„¢, the successor to " + Consts.APPLICATION_NAME, Consts.URL_SCELIGHT_HOME_PAGE );
	visitScelightLabel.setIcon( Icons.SCELIGHT );
	box.add( GuiUtils.wrapInPanel( visitScelightLabel ) );
	box.add( Box.createVerticalStrut( 10 ) );
	
	final JButton okButton = createCloseButton( "button.ok" );
	box.add( GuiUtils.wrapInPanel( okButton ) );
	
	getContentPane().add( box, BorderLayout.WEST );
	
	
	final VoiceDescription currentVoiceDesc = Sounds.getVoiceDescription( Settings.getString( Settings.KEY_SETTINGS_VOICE ) );
	final JTable infoTable = GuiUtils.createNonEditableTable();
	( (DefaultTableModel) infoTable.getModel() ).setDataVector(
		new Object[][] {
			{ Language.getText( "about.author"                       ), Language.formatPersonName( Consts.AUTHOR_FIRST_NAME, Consts.AUTHOR_LAST_NAME ) },
			{ Language.getText( "about.email"                        ), Consts.AUTHOR_EMAIL },
			{ Language.getText( "about.version"                      ), Consts.APPLICATION_VERSION },
			{ Language.getText( "about.releasedOn"                   ), Language.formatDate( Consts.APPLICATION_RELEASE_DATE ) },
			{ Language.getText( "about.currentLanguage"              ), Language.getLanguageName() },
			{ Language.getText( "about.currentTranslator"            ), Language.getTranslatorName() },
			{ Language.getText( "about.languageFileVersion"          ), Language.getLanguageFileVersion() + " (" + Language.getLanguageFileSubversion() + ")" },
			{ Language.getText( "about.currentVoice"                 ), currentVoiceDesc.displayName },
			{ Language.getText( "about.authorOfCurrentVoice"         ), Language.formatPersonName( currentVoiceDesc.authorFirstName, currentVoiceDesc.authorLastName ) },
			{ Language.getText( "about.updaterVersion", Consts.UPDATER_NAME ), Consts.UPDATER_VERSION },
			{ Language.getText( "about.replayParserVersion"          ), ReplayFactory.VERSION },
			{ Language.getText( "about.replayCacheVersion"           ), ReplayCache.CACHE_VERSION },
			{ Language.getText( "about.profileCacheVersion"          ), ProfileCache.CACHE_VERSION },
			{ Language.getText( "about.nameTemplateEngineVersion"    ), TemplateEngine.ENGINE_VERSION },
			{ Language.getText( "about.pluginApiVersion"             ), Plugin.API_VERSION },
			{ Language.getText( "about.pluginServicesImplVersion"    ), PluginServicesImpl.IMPL_VERSION },
			{ Language.getText( "about.generalServicesImplVersion"   ), GeneralServicesImpl.IMPL_VERSION },
			{ Language.getText( "about.eapmAlgorithmVersion"         ), EapmUtils.ALGORITHM_VERSION },
			{ Language.getText( "about.mousePracticeGameVersion"     ), MousePracticeGameFrame.GAME_VERSION },
			{ Language.getText( "about.smpdFormatVersion"            ), SmpdUtil.getVersionString( SmpdVer.V11.binaryValue ) },
			{ Language.getText( "about.privateVideoStreamingVersion" ), PrivateVideoStreaming.VERSION }
		}, new Object[] { "Property", "Value" } );
	GuiUtils.packTable( infoTable );
	final JPanel tableWrapper = new JPanel( new BorderLayout() );
	tableWrapper.add( infoTable );
	tableWrapper.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder( 15, 15, 15, 15 ), BorderFactory.createEtchedBorder() ) );
	getContentPane().add( tableWrapper, BorderLayout.CENTER );
	
	if ( Settings.getBoolean( Settings.KEY_SETTINGS_ENABLE_VOICE_NOTIFICATIONS ) )
		Sounds.playSoundSample( Sounds.SAMPLE_THANK_YOU, false );
	
	packAndShow( okButton, false );
}
 
Example 12
Source File: KitPanel.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void initComponents()
{
	renderer.setCharacter(character);
	FlippingSplitPane topPane = new FlippingSplitPane();
	setTopComponent(topPane);
	setOrientation(VERTICAL_SPLIT);

	FilterBar<Object, Kit> bar = new FilterBar<>();
	bar.addDisplayableFilter(new SearchFilterPanel());
	qFilterButton.setText(LanguageBundle.getString("in_igQualFilter")); //$NON-NLS-1$
	bar.addDisplayableFilter(qFilterButton);

	availableTable.setTreeViewModel(new KitTreeViewModel(character, true));
	availableTable.setTreeCellRenderer(renderer);

	JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTable, bar);

	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	addButton.setHorizontalTextPosition(SwingConstants.LEADING);
	addButton.setAction(addAction);
	box.add(addButton);
	box.add(Box.createHorizontalStrut(5));
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	availPanel.add(box, BorderLayout.SOUTH);

	topPane.setLeftComponent(availPanel);

	JPanel selPanel = new JPanel(new BorderLayout());
	FilterBar<Object, Kit> filterBar = new FilterBar<>();
	filterBar.addDisplayableFilter(new SearchFilterPanel());

	selectedTable.setDisplayableFilter(filterBar);
	selectedTable.setTreeViewModel(new KitTreeViewModel(character, false));
	selectedTable.setTreeCellRenderer(renderer);
	selPanel.add(new JScrollPane(selectedTable), BorderLayout.CENTER);

	topPane.setRightComponent(selPanel);
	setBottomComponent(infoPane);
	setResizeWeight(0.75);
}
 
Example 13
Source File: AbilityChooserTab.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void initComponents()
{
	setOrientation(VERTICAL_SPLIT);
	availableTreeViewPanel.setDefaultRenderer(Boolean.class, new BooleanRenderer());
	availableTreeViewPanel.setTreeCellRenderer(qualifiedRenderer);
	selectedTreeViewPanel.setTreeCellRenderer(abilityRenderer);
	FilterBar<CharacterFacade, AbilityFacade> filterBar = new FilterBar<>();
	filterBar.addDisplayableFilter(new SearchFilterPanel());

	qFilterButton.setText(LanguageBundle.getString("in_igQualFilter")); //$NON-NLS-1$
	filterBar.addDisplayableFilter(qFilterButton);
	JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTreeViewPanel, filterBar);
	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	addButton.setHorizontalTextPosition(SwingConstants.LEADING);
	box.add(addButton);
	box.add(Box.createHorizontalStrut(5));
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	availPanel.add(box, BorderLayout.SOUTH);
	JPanel selPanel = new JPanel(new BorderLayout());
	selPanel.add(new JScrollPane(selectedTreeViewPanel), BorderLayout.CENTER);
	AbilityTreeTableModel.initializeTreeTable(selectedTreeViewPanel);

	box = Box.createHorizontalBox();
	box.add(Box.createHorizontalStrut(5));
	box.add(removeButton);
	box.add(Box.createHorizontalGlue());
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	selPanel.add(box, BorderLayout.SOUTH);
	FlippingSplitPane topPane =
			new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, selPanel);

	setTopComponent(topPane);

	FilterButton<CharacterFacade, AbilityCategory> gainedFilterButton =
			new FilterButton<>("AbilityGained", true);
	gainedFilterButton.setText(LanguageBundle.getString("in_gained")); //$NON-NLS-1$
	gainedFilterButton.setEnabled(true);
	gainedFilterButton.setFilter((context, element) -> context.getActiveAbilityCategories().containsElement(element));
	categoryBar.addDisplayableFilter(gainedFilterButton);

	JPanel filterPanel = new JPanel(new BorderLayout());
	filterPanel.add(categoryBar, BorderLayout.NORTH);
	filterPanel.add(new JScrollPane(categoryTable), BorderLayout.CENTER);

	FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT);
	bottomPane.setLeftComponent(filterPanel);
	bottomPane.setRightComponent(infoPane);
	setBottomComponent(bottomPane);
}
 
Example 14
Source File: TemplateInfoTab.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void initComponents()
{
	FlippingSplitPane topPane = new FlippingSplitPane();
	setTopComponent(topPane);
	setOrientation(VERTICAL_SPLIT);

	JPanel availPanel = new JPanel(new BorderLayout());
	FilterBar<CharacterFacade, PCTemplate> bar = new FilterBar<>();
	bar.addDisplayableFilter(new SearchFilterPanel());
	qFilterButton.setText(LanguageBundle.getString("in_igQualFilter")); //$NON-NLS-1$
	bar.addDisplayableFilter(qFilterButton);
	availPanel.add(bar, BorderLayout.NORTH);

	availableTable.setDisplayableFilter(bar);
	availableTable.setTreeCellRenderer(qualifiedRenderer);
	availPanel.add(new JScrollPane(availableTable), BorderLayout.CENTER);

	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	addButton.setHorizontalTextPosition(SwingConstants.LEADING);
	box.add(addButton);
	box.add(Box.createHorizontalStrut(5));
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	availPanel.add(box, BorderLayout.SOUTH);

	topPane.setLeftComponent(availPanel);

	JPanel selPanel = new JPanel(new BorderLayout());
	FilterBar<CharacterFacade, PCTemplate> filterBar = new FilterBar<>();
	filterBar.addDisplayableFilter(new SearchFilterPanel());

	selectedTable.setDisplayableFilter(filterBar);
	selectedTable.setTreeCellRenderer(qualifiedRenderer);
	selPanel.add(new JScrollPane(selectedTable), BorderLayout.CENTER);

	box = Box.createHorizontalBox();
	box.add(Box.createHorizontalStrut(5));
	box.add(removeButton);
	box.add(Box.createHorizontalGlue());
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	selPanel.add(box, BorderLayout.SOUTH);

	topPane.setRightComponent(selPanel);
	setBottomComponent(infoPane);
	setResizeWeight(0.75);
}
 
Example 15
Source File: AbilityChooserTab.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void initComponents()
{
	setOrientation(VERTICAL_SPLIT);
	availableTreeViewPanel.setDefaultRenderer(Boolean.class, new BooleanRenderer());
	availableTreeViewPanel.setTreeCellRenderer(qualifiedRenderer);
	selectedTreeViewPanel.setTreeCellRenderer(abilityRenderer);
	FilterBar<CharacterFacade, AbilityFacade> filterBar = new FilterBar<>();
	filterBar.addDisplayableFilter(new SearchFilterPanel());

	qFilterButton.setText(LanguageBundle.getString("in_igQualFilter")); //$NON-NLS-1$
	filterBar.addDisplayableFilter(qFilterButton);
	JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTreeViewPanel, filterBar);
	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	addButton.setHorizontalTextPosition(SwingConstants.LEADING);
	box.add(addButton);
	box.add(Box.createHorizontalStrut(5));
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	availPanel.add(box, BorderLayout.SOUTH);
	JPanel selPanel = new JPanel(new BorderLayout());
	selPanel.add(new JScrollPane(selectedTreeViewPanel), BorderLayout.CENTER);
	AbilityTreeTableModel.initializeTreeTable(selectedTreeViewPanel);

	box = Box.createHorizontalBox();
	box.add(Box.createHorizontalStrut(5));
	box.add(removeButton);
	box.add(Box.createHorizontalGlue());
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	selPanel.add(box, BorderLayout.SOUTH);
	FlippingSplitPane topPane =
			new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, availPanel, selPanel);

	setTopComponent(topPane);

	FilterButton<CharacterFacade, AbilityCategory> gainedFilterButton =
			new FilterButton<>("AbilityGained", true);
	gainedFilterButton.setText(LanguageBundle.getString("in_gained")); //$NON-NLS-1$
	gainedFilterButton.setEnabled(true);
	gainedFilterButton.setFilter((context, element) -> context.getActiveAbilityCategories().containsElement(element));
	categoryBar.addDisplayableFilter(gainedFilterButton);

	JPanel filterPanel = new JPanel(new BorderLayout());
	filterPanel.add(categoryBar, BorderLayout.NORTH);
	filterPanel.add(new JScrollPane(categoryTable), BorderLayout.CENTER);

	FlippingSplitPane bottomPane = new FlippingSplitPane(JSplitPane.HORIZONTAL_SPLIT);
	bottomPane.setLeftComponent(filterPanel);
	bottomPane.setRightComponent(infoPane);
	setBottomComponent(bottomPane);
}
 
Example 16
Source File: PrintPreviewDialog.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void initLayout()
{
	Container pane = getContentPane();
	pane.setLayout(new BorderLayout());
	{//layout top bar
		JPanel bar = new JPanel(new GridBagLayout());
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.fill = GridBagConstraints.HORIZONTAL;
		gbc.anchor = GridBagConstraints.BASELINE;
		gbc.insets = new Insets(8, 6, 8, 2);
		bar.add(new JLabel("Select Template:"), gbc);
		gbc.insets = new Insets(8, 2, 8, 6);
		gbc.weightx = 1;
		bar.add(sheetBox, gbc);
		pane.add(bar, BorderLayout.NORTH);
	}
	{
		Box vbox = Box.createVerticalBox();
		previewPanelParent.setPreferredSize(new Dimension(600, 800));
		vbox.add(previewPanelParent);
		vbox.add(progressBar);
		pane.add(vbox, BorderLayout.CENTER);
	}
	{
		Box hbox = Box.createHorizontalBox();
		hbox.add(new JLabel("Page:"));
		hbox.add(Box.createHorizontalStrut(4));
		hbox.add(pageBox);
		hbox.add(Box.createHorizontalStrut(10));
		hbox.add(new JLabel("Zoom:"));
		hbox.add(Box.createHorizontalStrut(4));
		hbox.add(zoomBox);
		hbox.add(Box.createHorizontalStrut(5));
		hbox.add(zoomInButton);
		hbox.add(Box.createHorizontalStrut(5));
		hbox.add(zoomOutButton);
		hbox.add(Box.createHorizontalGlue());
		hbox.add(printButton);
		hbox.add(Box.createHorizontalStrut(5));
		hbox.add(cancelButton);
		hbox.setBorder(BorderFactory.createEmptyBorder(8, 5, 8, 5));
		pane.add(hbox, BorderLayout.SOUTH);
	}
}
 
Example 17
Source File: TempBonusInfoTab.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void initComponents()
{
	FlippingSplitPane topPane = new FlippingSplitPane();
	setTopComponent(topPane);
	setOrientation(VERTICAL_SPLIT);

	JPanel availPanel = new JPanel(new BorderLayout());
	FilterBar<CharacterFacade, TempBonusFacade> bar = new FilterBar<>();
	bar.addDisplayableFilter(new SearchFilterPanel());
	availPanel.add(bar, BorderLayout.NORTH);

	availableTable.setDisplayableFilter(bar);
	availableTable.setTreeCellRenderer(tempBonusRenderer);
	availPanel.add(new JScrollPane(availableTable), BorderLayout.CENTER);

	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	addButton.setHorizontalTextPosition(SwingConstants.LEADING);
	box.add(addButton);
	box.add(Box.createHorizontalStrut(5));
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	availPanel.add(box, BorderLayout.SOUTH);

	topPane.setLeftComponent(availPanel);

	JPanel selPanel = new JPanel(new BorderLayout());
	FilterBar<CharacterFacade, TempBonusFacade> filterBar = new FilterBar<>();
	filterBar.addDisplayableFilter(new SearchFilterPanel());

	selectedTable.setDisplayableFilter(filterBar);
	selectedTable.setTreeCellRenderer(tempBonusRenderer);
	selPanel.add(new JScrollPane(selectedTable), BorderLayout.CENTER);

	box = Box.createHorizontalBox();
	box.add(Box.createHorizontalStrut(5));
	box.add(removeButton);
	box.add(Box.createHorizontalGlue());
	box.setBorder(new EmptyBorder(0, 0, 5, 0));
	selPanel.add(box, BorderLayout.SOUTH);

	topPane.setRightComponent(selPanel);
	setBottomComponent(infoPane);
	setResizeWeight(0.75);
}
 
Example 18
Source File: DateIntervalListEditor.java    From ganttproject with GNU General Public License v3.0 4 votes vote down vote up
public DateIntervalListEditor(final DateIntervalModel intervalsModel) {
  super(new BorderLayout());
  myIntervalsModel = intervalsModel;
  myStart = new DefaultDateOption("generic.startDate") {
    @Override
    public void setValue(Date value) {
      super.setValue(value);
      if (intervalsModel.getMaxIntervalLength() == 1) {
        DateIntervalListEditor.this.myFinish.setValue(value);
      }
      DateIntervalListEditor.this.updateActions();
    }
  };
  myFinish = new DefaultDateOption("generic.endDate") {
    @Override
    public void setValue(Date value) {
      super.setValue(value);
      DateIntervalListEditor.this.updateActions();
    }
  };
  myAddAction = new GPAction("add") {
    @Override
    public void actionPerformed(ActionEvent e) {
      myIntervalsModel.add(DateInterval.createFromVisibleDates(myStart.getValue(), myFinish.getValue()));
      myListModel.update();
    }
  };
  myDeleteAction = new GPAction("delete") {
    @Override
    public void actionPerformed(ActionEvent e) {
      int selected = myListSelectionModel.getMinSelectionIndex();
      myIntervalsModel.remove(myIntervalsModel.getIntervals()[selected]);
      myListModel.update();
      myListSelectionModel.removeIndexInterval(selected, selected);
      updateActions();
    }
  };
  JPanel topPanel = new JPanel(new BorderLayout());
  OptionsPageBuilder builder = new OptionsPageBuilder();
  builder.setOptionKeyPrefix("");
  GPOptionGroup group = myIntervalsModel.getMaxIntervalLength() == 1 ? new GPOptionGroup("",
      new GPOption[] { myStart }) : new GPOptionGroup("", new GPOption[] { myStart, myFinish });
  group.setTitled(false);
  JComponent datesBox = builder.buildPlanePage(new GPOptionGroup[] { group });
  topPanel.add(datesBox, BorderLayout.CENTER);

  Box buttonBox = Box.createHorizontalBox();
  buttonBox.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
  buttonBox.add(new JButton(myAddAction));
  buttonBox.add(Box.createHorizontalStrut(5));
  buttonBox.add(new JButton(myDeleteAction));
  topPanel.add(buttonBox, BorderLayout.SOUTH);
  topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
  add(topPanel, BorderLayout.NORTH);

  JList list = new JList(myListModel);
  list.setName("list");
  list.setBorder(BorderFactory.createLoweredBevelBorder());
  myListSelectionModel = list.getSelectionModel();
  myListSelectionModel.addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      updateActions();
    }
  });
  JScrollPane scrollPane = new JScrollPane(list);
  scrollPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  scrollPane.setPreferredSize(new Dimension(120, 200));
  add(scrollPane, BorderLayout.CENTER);
  updateActions();
}
 
Example 19
Source File: ProgressDialog.java    From sc2gears with Apache License 2.0 4 votes vote down vote up
/**
 * Completes the initialization of the dialog.
 */
private void completeInit() {
	setModal( false );
	setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );
	
	( (JPanel) getContentPane() ).setBorder( BorderFactory.createEmptyBorder( 5, 10, 5, 10 ) );
	
	statsTable.setShowVerticalLines( true );
	( (DefaultTableModel) statsTable.getModel() ).setDataVector(
		new Object[][] {
			{ Language.getText( "progressDialog.elapsedTime"        ), null },
			{ Language.getText( "progressDialog.estRemainingTime"   ), null },
			{ Language.getText( "progressDialog.estTotalTime"       ), null },
			{ Language.getText( "progressDialog.avgProcessingSpeed" ), null }
		}, new Object[] { "Property", "Value" } );
	getContentPane().add( GuiUtils.wrapInBorderPanel( statsTable ), BorderLayout.NORTH );
	
	final Box centerBox = Box.createVerticalBox();
	centerBox.setBorder( BorderFactory.createEmptyBorder( 5, 0, 5, 0 ) );
	progressBar.setStringPainted( true );
	progressBar.setPreferredSize( new Dimension( 450, progressBar.getPreferredSize().height ) );
	progressBar.setMaximum( total );
	centerBox.add( progressBar );
	centerBox.add( Box.createVerticalStrut( 2 ) );
	failedLabel.setBorder( BorderFactory.createEmptyBorder( 0, 5, 0, 5 ) );
	failedLabel.setOpaque( true );
	infoPanel.add( failedLabel, BorderLayout.WEST );
	centerBox.add( infoPanel );
	getContentPane().add( centerBox, BorderLayout.CENTER );
	
	final JPanel buttonsPanel = new JPanel();
	GuiUtils.updateButtonText( button, "button.abort" );
	button.addActionListener( this );
	buttonsPanel.add( button );
	getContentPane().add( buttonsPanel, BorderLayout.SOUTH );
	
	startTime = System.currentTimeMillis();
	updateProgressBar();
	
	MainFrame.registerBackgroundJob();
	
	packAndShow( button, false );
}
 
Example 20
Source File: RecipeStepPanel.java    From cstc with GNU General Public License v3.0 4 votes vote down vote up
public RecipeStepPanel(String title, ChangeListener changelistener) {
	this.changeListener = changelistener;
	this.setLayout(new BorderLayout());
	this.setPreferredSize(new Dimension(300, 0));

	// header
	Box headerBox = Box.createHorizontalBox();
	// add borders
	Border margin = BorderFactory.createEmptyBorder(10, 10, 10, 10);
	MatteBorder lineBorder = new MatteBorder(0, 0, 2, 0, Color.DARK_GRAY);
	CompoundBorder border = new CompoundBorder(lineBorder, margin);
	headerBox.setBorder(border);

	JTextField contentTextField = new JTextField();
	contentTextField.setBorder(null);
	contentTextField.setBackground(new Color(0, 0, 0, 0));
	contentTextField.setText(title);
	headerBox.add(contentTextField);

	this.add(headerBox, BorderLayout.NORTH);

	// body
	operationsLine = new JPanel(new GridBagLayout());

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridwidth = GridBagConstraints.REMAINDER;
	gbc.gridheight = GridBagConstraints.REMAINDER;
	gbc.weightx = 1;
	gbc.weighty = 1;
	gbc.fill = GridBagConstraints.BOTH;

	JPanel dummyPanel = new JPanel();
	operationsLine.add(dummyPanel, gbc);

	this.addContraints = new GridBagConstraints();
	this.addContraints.gridwidth = GridBagConstraints.REMAINDER;
	this.addContraints.weightx = 1;
	this.addContraints.fill = GridBagConstraints.HORIZONTAL;

	JScrollPane scrollPane = new JScrollPane(operationsLine);
	scrollPane.setBorder(new MatteBorder(0, 2, 0, 0, Color.DARK_GRAY));
	scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
	scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
	scrollPane.getVerticalScrollBar().setUnitIncrement(16);

	this.add(scrollPane, BorderLayout.CENTER);
}