Java Code Examples for javax.swing.JSplitPane#setResizeWeight()

The following examples show how to use javax.swing.JSplitPane#setResizeWeight() . 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: SqlViewer.java    From CQL with GNU Affero General Public License v3.0 6 votes vote down vote up
public SqlViewer(Color color, SqlSchema info, SqlInstance inst) {
	super(new GridLayout(1, 1));
	this.info = info;
	this.inst = inst;
	this.color = color;

	makeCards();
	makeGraph();
	makeUI();

	if (inst == null) {
		add(top);
	} else {
		JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		pane.setResizeWeight(.75);
		pane.setDividerSize(2);
		pane.add(top);
		pane.add(bottom);
		add(pane);
	}
	setBorder(BorderFactory.createEtchedBorder());
}
 
Example 2
Source File: RegexDialog.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
public RegexDialog(RegexModel regexModel) {
    setTitle(DIALOG_TITLE);
    this.regexPanel = new RegexPanel(regexModel, () -> somethingChanged());
    this.testValuePanel = new TestValuePanel(regexModel, () -> somethingChanged());
    this.matchPanel = new MatchPanel(regexModel);

    setPreferredSize(new Dimension(1024, 768));

    JSplitPane centerSplit =
            new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, testValuePanel, matchPanel);
    centerSplit.setResizeWeight(0.5);
    centerSplit.setBorder(BorderFactory.createEmptyBorder());

    getContentPane().add(regexPanel, BorderLayout.NORTH);
    getContentPane().add(centerSplit, BorderLayout.CENTER);
}
 
Example 3
Source File: MatchPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
public MatchPanel(RegexModel regexModel) {
    super(new BorderLayout());
    this.regexModel = regexModel;

    resultField = createTextArea();
    captureField = createTextArea();
    matchField = new JLabel();
    matchField.setText(String.format(MATCHES_LABEL, ""));
    lookingAtField = new JLabel();
    lookingAtField.setText(String.format(LOOKING_AT_LABEL, ""));

    JPanel matchPanel = createPanel(MATCH_RESULT_HEADER);
    matchPanel.add(matchField, BorderLayout.NORTH);
    matchPanel.add(lookingAtField, BorderLayout.SOUTH);
    matchPanel.setPreferredSize(new Dimension(0, 80));

    JPanel findPanel = createPanel(resultField, FIND_RESULT_HEADER);
    JPanel capturePanel = createPanel(captureField, FIND_CAPTURE_HEADER);

    JSplitPane findSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, findPanel, capturePanel);
    findSplit.setResizeWeight(0.35);
    findSplit.setBorder(BorderFactory.createEmptyBorder());

    add(matchPanel, BorderLayout.NORTH);
    add(findSplit, BorderLayout.CENTER);
}
 
Example 4
Source File: OQLControllerUI.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private void initComponents() {
    JSplitPane querySplitter = new JExtendedSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                    oqlController.getQueryController().getPanel(),
                                    oqlController.getSavedController().getPanel());
    tweakSplitPaneUI(querySplitter);
    querySplitter.setResizeWeight(1d);

    JSplitPane mainSplitter = new JExtendedSplitPane(JSplitPane.VERTICAL_SPLIT,
                                    oqlController.getResultsController().getPanel(),
                                    querySplitter);
    tweakSplitPaneUI(mainSplitter);
    mainSplitter.setResizeWeight(1d);

    setLayout(new BorderLayout());
    add(mainSplitter, BorderLayout.CENTER);
}
 
Example 5
Source File: CSSStylesSelectionPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@code CSSStylesSelectionPanel}.
 */
CSSStylesSelectionPanel() {
    setLayout(new BorderLayout());
    JSplitPane splitPane = createSplitPane();
    splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(initPropertyPane());
    splitPane.setBottomComponent(initRulePane());
    splitPane.setDividerSize(4);
    splitPane.setResizeWeight(0.5);
    splitPane.setBorder(null);
    selectionView = splitPane;
    initMessagePanel();
    initSelectionOfOwningRule();
    add(selectionView, BorderLayout.CENTER);
    updateContent(null, false);
}
 
Example 6
Source File: ManualHttpRequestEditorPanel.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
private JSplitPane createSplitPane(int orientation) {
    final JTabbedPane tabbedPaneRequest = new JTabbedPane();
    tabbedPaneRequest.addTab(REQUEST_CAPTION, null, requestPanel, null);

    final JTabbedPane tabbedPaneResponse = new JTabbedPane();
    tabbedPaneResponse.addTab(RESPONSE_CAPTION, null, responsePanel, null);

    final JSplitPane splitPane =
            new JSplitPane(orientation, tabbedPaneRequest, tabbedPaneResponse);
    splitPane.setDividerSize(3);
    splitPane.setResizeWeight(0.5d);
    splitPane.setContinuousLayout(false);
    splitPane.setDoubleBuffered(true);

    int dividerLocation;
    if (orientation == JSplitPane.HORIZONTAL_SPLIT) {
        dividerLocation = horizontalDividerLocation;
    } else {
        dividerLocation = verticalDividerLocation;
    }
    splitPane.setDividerLocation(dividerLocation);

    return splitPane;
}
 
Example 7
Source File: ImageORPanel.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void init() {
    setLayout(new BorderLayout());
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setOneTouchExpandable(true);
    splitPane.setBottomComponent(objectTable);
    TreeSearch tSearch = TreeSearch.installForOR(objectTree.getTree());
    splitPane.setTopComponent(tSearch);
    splitPane.setResizeWeight(.5);
    splitPane.setDividerLocation(.5);
    add(splitPane);
}
 
Example 8
Source File: WebORPanel.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void init() {
    setLayout(new BorderLayout());
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setOneTouchExpandable(true);
    splitPane.setBottomComponent(objectTable);
    TreeSearch tSearch = TreeSearch.installForOR(objectTree.getTree());
    splitPane.setTopComponent(tSearch);
    splitPane.setResizeWeight(.5);
    splitPane.setDividerLocation(.5);
    add(splitPane);
}
 
Example 9
Source File: CDebugEventListPanel.java    From binnavi with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new debug event list panel where debug events are displayed.
 *
 * @param eventListManager Provides the event lists that are displayed in this panel.
 */
public CDebugEventListPanel(final ITraceListProvider eventListManager) {
  super(new BorderLayout());

  Preconditions.checkNotNull(
      eventListManager, "IE01369: Event list manager argument can't be null");

  // Create the table that shows the recorded event lists.
  m_tracesTable = new CEventListTable(eventListManager);

  // Add a selection listener that updates the right table
  // if the selection in the left table changes.
  m_tracesTable.getSelectionModel().addListSelectionListener(new InternalSelectionListener());

  final JPanel rightPanel = new JPanel(new BorderLayout());

  m_traceEventTable = new CEventTable(new CEventTableModel());
  m_traceEventTable.getSelectionModel()
      .addListSelectionListener(new InternalEventSelectionListener());

  final CTablePanel<ITraceEvent> filteredPanel = new CTraceEventsPanel(m_traceEventTable);

  m_eventValueTable = new CEventValueTable(m_eventModel);
  m_eventValueTable.addMouseListener(new InternalMouseListener());

  final JSplitPane splitPane1 = new JSplitPane(
      JSplitPane.HORIZONTAL_SPLIT, true, filteredPanel, new JScrollPane(m_eventValueTable));
  rightPanel.add(splitPane1, BorderLayout.CENTER);
  splitPane1.setResizeWeight(0.5);

  m_tracesPanel = new CTracesPanel(m_tracesTable);

  final JSplitPane splitPane =
      new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, m_tracesPanel, rightPanel);
  add(splitPane, BorderLayout.CENTER);
  splitPane.setResizeWeight(0.5);
}
 
Example 10
Source File: FeatureOverviewWindow.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
private JSplitPane addSpectraMS2() {
  JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  SpectraVisualizerWindow spectraWindowMS2 = new SpectraVisualizerWindow(rawFiles[0]);
  spectraWindowMS2.loadRawData(rawFiles[0].getScan(feature.getMostIntenseFragmentScanNumber()));

  pane.add(spectraWindowMS2.getSpectrumPlot());
  pane.add(spectraWindowMS2.getToolBar());
  pane.setResizeWeight(1);
  pane.setEnabled(false);
  pane.setDividerSize(0);
  return pane;
}
 
Example 11
Source File: PSheet.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private JSplitPane createSplitPane(Component lower) {
    JSplitPane pane = new JSplitPane();

    if (firstSplit == null) {
        firstSplit = Boolean.TRUE;
    } else {
        firstSplit = Boolean.FALSE;
    }

    pane.setRightComponent(lower);
    pane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    pane.setContinuousLayout(true);
    pane.setResizeWeight(1);
    pane.setDividerLocation(0.80f);
    pane.setBorder(BorderFactory.createEmptyBorder());
    //Do not install our custom split pane UI on Nimbus L&F
    if (!"Nimbus".equals(UIManager.getLookAndFeel().getID())) {
        pane.setUI(PropUtils.createSplitPaneUI());
    }

    // #52188: default F6 behaviour doesn't make to much sense in NB 
    // property sheet and blocks NetBeans default F6
    pane.getActionMap().getParent().remove("toggleFocus");
    if( PropUtils.isAqua ) {
        pane.setBackground( UIManager.getColor("NbExplorerView.background") ); //NOI18N
    }

    return pane;
}
 
Example 12
Source File: PayloadPreviewPanel.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
private static JPanel createSplitPanel(
        JPanel leftPanel,
        JPanel rightPanel,
        final SyncScrollBarsAdjustmentListener syncScrollPanes) {
    JPanel panel = new JPanel();

    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateGaps(true);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
    splitPane.setDividerLocation(0.5D);
    splitPane.setResizeWeight(0.5D);

    JCheckBox syncScrollBarsCheckbox = new JCheckBox(LOCK_SCROLL_BARS_BUTTON_LABEL);
    syncScrollBarsCheckbox.setSelected(true);
    syncScrollBarsCheckbox.addItemListener(
            new ItemListener() {

                @Override
                public void itemStateChanged(ItemEvent e) {
                    syncScrollPanes.setSync(e.getStateChange() == ItemEvent.SELECTED);
                }
            });

    layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(splitPane)
                    .addComponent(syncScrollBarsCheckbox));
    layout.setVerticalGroup(
            layout.createSequentialGroup()
                    .addComponent(splitPane)
                    .addComponent(syncScrollBarsCheckbox));

    return panel;
}
 
Example 13
Source File: DeckEditorSplitPanel.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private Container getMainContentContainer() {

        // card pool
        cardPoolDefs = filterPanel.getFilteredCards();

        cardPoolTable = new CardTablePanelB(cardPoolDefs, generatePoolTitle(), false);
        cardPoolTable.addMouseListener(new CardPoolMouseListener());
        cardPoolTable.addCardSelectionListener(this);

        cardPoolTable.setDeckEditorSelectionMode();

        deckDefs = this.deck;
        deckTable = new CardTablePanelB(deckDefs, generateDeckTitle(deckDefs), true);
        deckTable.addMouseListener(new DeckMouseListener());
        deckTable.addCardSelectionListener(this);
        deckTable.setDeckEditorSelectionMode();
        deckTable.showCardCount(true);

        final JPanel deckPanel = new JPanel();
        deckPanel.setOpaque(false);
        deckPanel.setLayout(new MigLayout("insets 0, gap 0, flowy"));
        deckPanel.add(buttonsPanel, "w 100%, h 40!");
        deckPanel.add(deckTable, "w 100%, h 100%");

        cardsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        cardsSplitPane.setOneTouchExpandable(false);
        cardsSplitPane.setLeftComponent(cardPoolTable);
        cardsSplitPane.setRightComponent(deckPanel);
        cardsSplitPane.setResizeWeight(0.5);
        cardsSplitPane.setDividerSize(14);
        cardsSplitPane.setBorder(null);
        cardsSplitPane.setOpaque(false);
        cardsSplitPane.setDividerLocation(getDividerPosition());

        // update deck stats
        sideBarPanel.setDeck(this.deck);

        return cardsSplitPane;

    }
 
Example 14
Source File: FeatureOverviewWindow.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
private JSplitPane addSpectraMS1() {
  JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  SpectraVisualizerWindow spectraWindowMS1 = new SpectraVisualizerWindow(rawFiles[0]);
  spectraWindowMS1.loadRawData(rawFiles[0].getScan(feature.getRepresentativeScanNumber()));

  pane.add(spectraWindowMS1.getSpectrumPlot());
  pane.add(spectraWindowMS1.getToolBar());
  pane.setResizeWeight(1);
  pane.setEnabled(false);
  pane.setDividerSize(0);
  return pane;
}
 
Example 15
Source File: CampaignEditor.java    From open-ig with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Initialize the internal components.
 */
private void initComponents() {
	undoManager = new UndoManager();
	
	warning = new ImageIcon(CampaignEditor.class.getResource("/hu/openig/gfx/warning.png"));
	error = new ImageIcon(CampaignEditor.class.getResource("/hu/openig/gfx/error.png"));
	
	labels = new HashMap<>();
	flags = new HashMap<>();
	
	// fetch labels
	try {
		XElement xlabels = XElement.parseXML(CampaignEditor.class.getResource("ce_labels.xml"));
		for (XElement xlang : xlabels.childrenWithName("language")) {
			String id = xlang.get("id");
			if (id.equals(language)) {
				for (XElement xentry : xlang.childrenWithName("entry")) {
					String key = xentry.get("key");
					if (key != null && !key.isEmpty() && xentry.content != null && !xentry.content.isEmpty()) {
						labels.put(key, xentry.content);
					}
				}
			}
			flags.put(id, new ImageIcon(CampaignEditor.class.getResource(xlang.get("flag"))));
		}
	} catch (XMLStreamException | IOException ex) {
		Exceptions.add(ex);
	}
	
	ToolTipManager.sharedInstance().setDismissDelay(120000);
	
	mainMenu = new JMenuBar();
	
	initMenu();

	toolbar = new JToolBar();
	
	initToolbar();
	
	mainSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

	tabs = new JTabbedPane();
	
	initTabs();
	
	problemPanel = new JPanel();
	
	mainSplit.setTopComponent(tabs);
	mainSplit.setBottomComponent(problemPanel);
	mainSplit.setOneTouchExpandable(true);
	mainSplit.setResizeWeight(1d);
	
	setJMenuBar(mainMenu);
	
	Container c = getContentPane();
	
	c.add(toolbar, BorderLayout.PAGE_START);
	c.add(mainSplit, BorderLayout.CENTER);
	// TODO other stuff
	
	updateUndoRedo();
	startupDialog = new CEStartupDialog(this);
	
	// FIXME disabled menu and toolbars
	
	mnuFileOpen.setEnabled(false);
	mnuFileSave.setEnabled(false);
	mnuFileSaveAs.setEnabled(false);
	mnuFileImport.setEnabled(false);
	mnuFileExport.setEnabled(false);
	
	mnuEditCopy.setEnabled(false);
	mnuEditCut.setEnabled(false);
	mnuEditPaste.setEnabled(false);
	mnuEditDelete.setEnabled(false);
	
	mnuHelpAbout.setEnabled(false);
	
	toolbarOpen.setEnabled(false);
	toolbarSave.setEnabled(false);
	toolbarImport.setEnabled(false);
	toolbarExport.setEnabled(false);
	toolbarCut.setEnabled(false);
	toolbarCopy.setEnabled(false);
	toolbarPaste.setEnabled(false);
	toolbarRemove.setEnabled(false);
	toolbarSaveAs.setEnabled(false);
}
 
Example 16
Source File: VisualisationFrame.java    From chipster with MIT License 4 votes vote down vote up
public JComponent createVisualisation(VisualisationMethodChangedEvent e) {
	
	JComponent componentToReturn = null;

	try {
		// Create new visualiser only if needed to keep the settings made in settings panel
		if (this.datas != e.getDatas() || this.method != e.getNewMethod()) {
			this.datas = e.getDatas();
			this.method = e.getNewMethod();

			removeVisualiser();
			visualiser = method.getVisualiser(this);
		}
		this.variables = e.getVariables();

		// parameter panel has to be first one to make it initialised before the
		// data is set (scatterplot)
		JPanel parametersPanel = visualiser.getParameterPanel();
		logger.debug("parametersPanel for method " + method + " contains: " + parametersPanel);
		if (parametersPanel != null) {
			paramSplit = new JSplitPane();
			parametersPanel.setMinimumSize(new Dimension(0, 0));
			paramSplit.setRightComponent(parametersPanel);
			// To show the width limit of parameter panel
			paramSplit.setContinuousLayout(true);
			// To keep the parameter panel size constant
			paramSplit.setResizeWeight(1.0);

			SplitSizeHandler sizeHandler = new SplitSizeHandler();
			paramSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, sizeHandler);
		} else {
			//Do not keep references to old visualization to avoid memory leak
			if (paramSplit != null) {
				paramSplit.removeAll();
			}
		}

		JComponent visualisationComponent = null;


		if (visualiser.isForMultipleDatas()) {
			visualisationComponent = visualiser.getVisualisation(datas);
		} else if (visualiser.isForSingleData()) {
			DataBean data = datas.size() > 0 ? datas.get(0) : null;
			visualisationComponent = visualiser.getVisualisation(data);
		}

		if (parametersPanel != null) {
			paramSplit.setLeftComponent(visualisationComponent);
			componentToReturn = paramSplit;
		} else {
			componentToReturn = visualisationComponent;
		}
		
	} catch (Exception e1) {
		application.reportException(e1);
		componentToReturn = visualiser.getDefaultVisualisation();
	}

	return componentToReturn;
}
 
Example 17
Source File: PropertySheetPanel.java    From orbit-image-analysis with GNU General Public License v3.0 4 votes vote down vote up
private void buildUI() {
  LookAndFeelTweaks.setBorderLayout(this);
  LookAndFeelTweaks.setBorder(this);

  actionPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 2, 0));
  actionPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
  add("North", actionPanel);

  sortButton = new JToggleButton(new ToggleSortingAction());
  sortButton.setUI(new BlueishButtonUI());
  sortButton.setText(null);
  actionPanel.add(sortButton);

  asCategoryButton = new JToggleButton(new ToggleModeAction());
  asCategoryButton.setUI(new BlueishButtonUI());
  asCategoryButton.setText(null);
  actionPanel.add(asCategoryButton);

  descriptionButton = new JToggleButton(new ToggleDescriptionAction());
  descriptionButton.setUI(new BlueishButtonUI());
  descriptionButton.setText(null);
  actionPanel.add(descriptionButton);

  split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  split.setBorder(null);
  split.setResizeWeight(1.0);
  split.setContinuousLayout(true);
  add("Center", split);
  
  tableScroll = new JScrollPane();
  split.setTopComponent(tableScroll);

  descriptionPanel = new JEditorPane("text/html", "<html>");
  descriptionPanel.setBorder(BorderFactory.createEmptyBorder());
  descriptionPanel.setEditable(false);
  descriptionPanel.setBackground(UIManager.getColor("Panel.background"));
  LookAndFeelTweaks.htmlize(descriptionPanel);

  selectionListener = new SelectionListener();

  descriptionScrollPane = new JScrollPane(descriptionPanel);
  descriptionScrollPane.setBorder(LookAndFeelTweaks.addMargin(BorderFactory
    .createLineBorder(UIManager.getColor("controlDkShadow"))));
  descriptionScrollPane.getViewport().setBackground(
    descriptionPanel.getBackground());
  descriptionScrollPane.setMinimumSize(new Dimension(50, 50));
  split.setBottomComponent(descriptionScrollPane);
  
  // by default description is not visible, toolbar is visible.
  setDescriptionVisible(false);
  setToolBarVisible(true);
}
 
Example 18
Source File: MainWindow.java    From dummydroid with Apache License 2.0 4 votes vote down vote up
public MainWindow() {
	super("Dummy Droid");
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	JMenuBar mbar = new JMenuBar();
	JMenu fileMenu = new JMenu(new FileMenuAction());
	fileMenu.add(new JMenuItem(new QuitAction()));
	mbar.add(fileMenu);
	setJMenuBar(mbar);

	FormData formData = new FormData();

	JEditorPane description = new HypertextPane("");
	description.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
	description.addHyperlinkListener(new BrowseUtil());
	JPanel formContainer = new JPanel();
	formContainer.setLayout(new CardLayout());

	NavigateAction forward = new NavigateAction(description, formContainer, NavigateAction.FORWARD,
			formData);
	NavigateAction backward = new NavigateAction(description, formContainer, NavigateAction.BACK,
			formData);

	formContainer.add(new LoadForm(forward, backward), LoadForm.class.getName());
	formContainer.add(new HardwareForm(forward, backward), HardwareForm.class.getName());
	formContainer.add(new SoftwareForm(forward, backward), SoftwareForm.class.getName());
	formContainer.add(new MiscForm(forward, backward), MiscForm.class.getName());
	formContainer.add(new NativeForm(forward, backward), NativeForm.class.getName());
	formContainer.add(new SharedlibForm(forward, backward), SharedlibForm.class.getName());
	formContainer.add(new FeaturesForm(forward, backward), FeaturesForm.class.getName());
	formContainer.add(new LocalesForm(forward, backward), LocalesForm.class.getName());
	formContainer.add(new CredentialsForm(forward,backward),CredentialsForm.class.getName());
	formContainer.add(new CheckinForm(forward, backward), CheckinForm.class.getName());

	JButton next = new JButton(forward);
	JButton previous = new JButton(backward);
	JLabel content = new JLabel("");
	JPanel buttonBar = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	buttonBar.add(previous);
	buttonBar.add(next);
	content.setLayout(new BorderLayout());
	JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
			new JScrollPane(description), formContainer);
	splitPane.setResizeWeight(1);
	content.add(splitPane, BorderLayout.CENTER);
	content.add(buttonBar, BorderLayout.SOUTH);
	setContentPane(content);
	forward.toScreen();
}
 
Example 19
Source File: PropertySheetPanel.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
private void buildUI() {
  LookAndFeelTweaks.setBorderLayout(this);
  LookAndFeelTweaks.setBorder(this);

  actionPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 2, 0));
  actionPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
  actionPanel.setOpaque(false);
  add("North", actionPanel);

  sortButton = new JToggleButton(new ToggleSortingAction());
  sortButton.setUI(new BlueishButtonUI());
  sortButton.setText(null);
  sortButton.setOpaque(false);
  actionPanel.add(sortButton);

  asCategoryButton = new JToggleButton(new ToggleModeAction());
  asCategoryButton.setUI(new BlueishButtonUI());
  asCategoryButton.setText(null);
  asCategoryButton.setOpaque(false);
  actionPanel.add(asCategoryButton);

  descriptionButton = new JToggleButton(new ToggleDescriptionAction());
  descriptionButton.setUI(new BlueishButtonUI());
  descriptionButton.setText(null);
  descriptionButton.setOpaque(false);
  actionPanel.add(descriptionButton);

  split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  split.setBorder(null);
  split.setResizeWeight(1.0);
  split.setContinuousLayout(true);
  add("Center", split);
  
  tableScroll = new JScrollPane();
  tableScroll.setBorder(BorderFactory.createEmptyBorder());
  split.setTopComponent(tableScroll);

  descriptionPanel = new JEditorPane("text/html", "<html>");
  descriptionPanel.setBorder(BorderFactory.createEmptyBorder());
  descriptionPanel.setEditable(false);
  descriptionPanel.setBackground(UIManager.getColor("Panel.background"));
  LookAndFeelTweaks.htmlize(descriptionPanel);

  selectionListener = new SelectionListener();

  descriptionScrollPane = new JScrollPane(descriptionPanel);
  descriptionScrollPane.setBorder(LookAndFeelTweaks.addMargin(BorderFactory
    .createLineBorder(UIManager.getColor("controlDkShadow"))));
  descriptionScrollPane.getViewport().setBackground(
    descriptionPanel.getBackground());
  descriptionScrollPane.setMinimumSize(new Dimension(50, 50));
  split.setBottomComponent(descriptionScrollPane);
  
  // by default description is not visible, toolbar is visible.
  setDescriptionVisible(false);
  setToolBarVisible(true);
}
 
Example 20
Source File: ReversiPlugin.java    From Spark with Apache License 2.0 3 votes vote down vote up
/**
 * Displays the game board. This is called after an offer has been accepted
 * or after accepting an invitation.
 * 
 * @param gameID
 *            the game ID.
 * @param room
 *            the chat room to display the game board in.
 * @param startingPlayer
 *            true if this player is the starting player (black).
 * @param opponentJID
 *            the opponent's JID.
 */
private void showReversiBoard(int gameID, ChatRoom room, boolean startingPlayer, Jid opponentJID) {
    JSplitPane pane = room.getSplitPane();
    pane.setResizeWeight(1.0);
    BackgroundPanel reversiBackground = new BackgroundPanel();
    reversiBackground.setLayout(new BorderLayout());
    reversiBackground.setOpaque(false);
    ReversiPanel reversi = new ReversiPanel(SparkManager.getConnection(), gameID, startingPlayer, opponentJID);
    reversiBackground.add(reversi, BorderLayout.CENTER);
    pane.setRightComponent(reversiBackground);
    reversi.setMinimumSize(new Dimension(ReversiPanel.TOTAL_WIDTH, ReversiPanel.TOTAL_HEIGHT));
}