Java Code Examples for java.awt.GridBagConstraints#NORTHWEST
The following examples show how to use
java.awt.GridBagConstraints#NORTHWEST .
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: EncodeDecodeDialog.java From zap-extensions with Apache License 2.0 | 6 votes |
private void addField(JPanel parent, JComponent c, String title) { final GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = globalOutputPanelIndex++; gbc.insets = new java.awt.Insets(1, 1, 1, 1); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 0.5D; gbc.weighty = 0.5D; final JScrollPane jsp = new JScrollPane(); jsp.setViewportView(c); jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jsp.setBorder( BorderFactory.createTitledBorder( null, title, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard))); parent.add(jsp, gbc); }
Example 2
Source File: LogPanel.java From Robot-Overlord-App with GNU General Public License v2.0 | 5 votes |
public LogPanel(Translator translator, RobotEntity robot) { this.translator = translator; this.robot = robot; // log panel Log.addListener(this); // the log panel log = new JTextPane(); log.setEditable(false); log.setBackground(Color.BLACK); kit = new HTMLEditorKit(); doc = new HTMLDocument(); log.setEditorKit(kit); log.setDocument(doc); DefaultCaret caret = (DefaultCaret) log.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); JScrollPane logPane = new JScrollPane(log); // Now put all the parts together panel.setLayout(new GridBagLayout()); GridBagConstraints con1 = new GridBagConstraints(); con1.gridx = 0; con1.gridy = 0; con1.weightx=1; con1.weighty=1; con1.fill=GridBagConstraints.HORIZONTAL; con1.anchor=GridBagConstraints.NORTHWEST; panel.add(logPane,con1); con1.gridy++; con1.weightx=1; con1.weighty=0; panel.add(getTextInputField(),con1); // lastly, clear the log clearLog(); }
Example 3
Source File: DesktopImpl.java From netbeans with Apache License 2.0 | 5 votes |
public void addSlidingView (SlidingView view) { Set<SlidingView> slidingViews = getSlidingViews(); if (slidingViews.contains(view)) { return; } slidingViews.add(view); GridBagConstraints constraint = new GridBagConstraints(); constraint.fill = GridBagConstraints.BOTH; if (Constants.BOTTOM.equals(view.getSide())) { constraint.gridx = 0; constraint.gridy = 2; constraint.gridwidth = 3; constraint.anchor = GridBagConstraints.SOUTHWEST; } else if (Constants.LEFT.equals(view.getSide())) { constraint.gridx = 0; constraint.gridy = 1; constraint.gridheight = 1; constraint.anchor = GridBagConstraints.NORTHWEST; } else if (Constants.RIGHT.equals(view.getSide())) { constraint.gridx = 2; constraint.gridy = 1; constraint.gridheight = 1; constraint.anchor = GridBagConstraints.NORTHEAST; } else if (Constants.TOP.equals(view.getSide())) { constraint.gridx = 1; constraint.gridy = 0; constraint.gridheight = 1; constraint.gridwidth = 2; constraint.anchor = GridBagConstraints.NORTHWEST; } desktop.add(view.getComponent(), constraint); if( Constants.BOTTOM.equals( view.getSide()) && view.getComponent() instanceof JPanel ) { JPanel panel = ( JPanel ) view.getComponent(); MainWindow.getInstance().setStatusBarContainer( panel ); } // #45033 fix - invalidate isn't enough, revalidate is correct layeredPane.revalidate(); }
Example 4
Source File: ColumnListDialog.java From bigtable-sql with Apache License 2.0 | 5 votes |
private GridBagConstraints getFieldConstraints(GridBagConstraints c) { c.gridx++; c.anchor = GridBagConstraints.NORTHWEST; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; return c; }
Example 5
Source File: ShowcaseExampleDemo.java From pumpernickel with MIT License | 5 votes |
private void layoutComponents() { removeAll(); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.insets = new Insets(10, 3, 3, 3); c.anchor = GridBagConstraints.NORTHWEST; add(configurationLabel, c); c.gridy++; c.insets = new Insets(3, 3, 3, 3); if (stretchConfigurationToFillHoriz) { c.fill = GridBagConstraints.HORIZONTAL; } add(configurationPanel, c); c.fill = GridBagConstraints.NONE; c.gridy++; c.insets = new Insets(10, 3, 3, 3); add(exampleLabel, c); c.gridy++; c.weighty = 1; c.weightx = 1; c.insets = new Insets(3, 3, 3, 3); if (stretchExampleToFillHoriz && stretchExampleToFillVert) { c.fill = GridBagConstraints.BOTH; } else if (stretchExampleToFillVert) { c.fill = GridBagConstraints.VERTICAL; } else if (stretchExampleToFillHoriz) { c.fill = GridBagConstraints.HORIZONTAL; } add(examplePanel, c); }
Example 6
Source File: ShareToolBuilder.java From raccoon4 with Apache License 2.0 | 5 votes |
@Override protected JPanel assemble() { JPanel ret = new JPanel(); TitleStrip titleStrip = new TitleStrip(Messages.getString(ID + ".title"), Messages.getString(ID + ".subtitle"), new ImageIcon(getClass() .getResource("/icons/appicon.png"))); transfer = new QrPanel(300); transfer.withActions(new CopyContentAction(globals, transfer)); transfer.setBorder(new TitledBorder(Messages.getString(ID + ".transfer"))); chooser = new JFileChooser(globals.get(Layout.class).shareDir); chooser.setMultiSelectionEnabled(true); chooser.setControlButtonsAreShown(false); chooser.addPropertyChangeListener(this); ret.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.weightx = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; ret.add(titleStrip, gbc); gbc.gridy = 1; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; ret.add(chooser, gbc); gbc.gridx = 1; gbc.insets = new Insets(7, 7, 7, 7); ret.add(transfer, gbc); return ret; }
Example 7
Source File: SdksCustomizer.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private static void addComponent(Container container, Component component) { GridBagConstraints c = new GridBagConstraints(); c.gridx = c.gridy = GridBagConstraints.RELATIVE; c.gridheight = c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTHWEST; c.weightx = c.weighty = 1.0; ((GridBagLayout) container.getLayout()).setConstraints(component, c); container.add(component); }
Example 8
Source File: MatchingEntryRenderer.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Creates a new renderer. */ public MatchingEntryRenderer() { textLabel = new JLabel(); matchLabel = new JLabel() { @Override public Dimension getPreferredSize() { return new Dimension(36, super.getPreferredSize().height); } @Override public Dimension getMinimumSize() { return getPreferredSize(); } @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 3)); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weighty = 0; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(0, 0, 0, 0); c.weightx = 0; c.gridwidth = GridBagConstraints.RELATIVE; add(matchLabel, c); c.weightx = 1; c.gridwidth = GridBagConstraints.REMAINDER; add(textLabel, c); }
Example 9
Source File: RepInfoBox.java From scelight with Apache License 2.0 | 4 votes |
/** * Builds the GUI of the rep info box. * * @param fileChooser file chooser whose selected file to listen */ private void buildGui( final XFileChooser fileChooser ) { final Dimension mindim = new Dimension( 16, 16 ); final GridBagConstraints c = this.c; c.insets.set( 1, 1, 0, 1 ); nextRow(); addDouble( RepUtils.createRepFoldersShortcutCombo( fileChooser ) ); nextRow(); addDouble( new JSeparator() ); nextRow(); addDouble( GuiUtils.boldFont( repInfoLabel ) ); nextRow(); addSingle( new XLabel( "Date:" ) ); c.weightx = 1; // Specify that the first column is compact and 2nd column gets the extra space addSingle( dateLabel ); c.weightx = 0; nextRow(); addSingle( new XLabel( "Version:" ) ); versionLabel.setPreferredSize( mindim ); versionLabel.setMaximumSize( mindim ); versionLabel.setMinimumSize( mindim ); addSingle( versionLabel ); nextRow(); addSingle( new XLabel( "Mode:" ) ); addSingle( modeLabel ); nextRow(); addSingle( new XLabel( "Length:" ) ); addSingle( lengthLabel ); nextRow(); addSingle( new XLabel( "Avg League:" ) ); avgLeagueLabel.setPreferredSize( mindim ); avgLeagueLabel.setMaximumSize( mindim ); avgLeagueLabel.setMinimumSize( mindim ); addSingle( avgLeagueLabel ); nextRow(); addSingle( new XLabel( "Matchup:" ) ); addSingle( matchupLabel ); nextRow(); addSingle( new XLabel( "Region:" ) ); addSingle( regionLabel ); nextRow(); c.anchor = GridBagConstraints.NORTHWEST; addSingle( new XLabel( "Players:" ) ); addSingle( playersLabel ); c.anchor = GridBagConstraints.LINE_START; nextRow(); addSingle( new XLabel( "Map:" ) ); addSingle( mapTitleLabel ); nextRow(); c.weighty = 1; // Remaining space for the map image addDouble( mapImageLabel ); c.weighty = 0; }
Example 10
Source File: AdditionalOptionsStep.java From kieker with Apache License 2.0 | 4 votes |
private void addAndLayoutComponents() { this.setLayout(new GridBagLayout()); final GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.BOTH; this.add(this.infoLabel, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets.set(5, 5, 0, 0); this.add(this.verbose, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets.set(0, 5, 0, 0); this.add(this.ignoreAssumedCalls, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets.set(0, 5, 0, 0); this.add(this.ignoreInvalidTraces, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets.set(0, 5, 0, 0); this.add(this.repairEventBasedTraces, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets.set(0, 5, 0, 0); this.add(this.useShortLabels, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.insets.set(0, 5, 0, 0); this.add(this.includeSelfLoops, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.gridwidth = 1; gridBagConstraints.weightx = 0.0; this.add(this.maxTraceDurationMS, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; this.add(this.maxTraceDurationMSInput, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.gridwidth = 1; gridBagConstraints.weightx = 0.0; this.add(this.traceColoringMap, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.BOTH; this.add(this.traceColoringMapInput, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.VERTICAL; this.add(this.traceColoringMapChooseButton, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.gridwidth = 1; gridBagConstraints.weightx = 0.0; this.add(this.description, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.BOTH; this.add(this.descriptionInput, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.VERTICAL; this.add(this.descriptionChooseButton, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.weighty = 1.0; gridBagConstraints.fill = GridBagConstraints.VERTICAL; this.add(this.expandingPanel, gridBagConstraints); }
Example 11
Source File: TraceEventTypePopupMenu.java From pega-tracerviewer with Apache License 2.0 | 4 votes |
private void populateCheckBoxLabelMenuItemListJPanel() { JPanel checkBoxLabelMenuItemListJPanel = getCheckBoxLabelMenuItemListJPanel(); checkBoxLabelMenuItemList.clear(); checkBoxLabelMenuItemListJPanel.removeAll(); JPanel traceEventTypesJPanel = new JPanel(); traceEventTypesJPanel.setLayout(new GridBagLayout()); JPanel traceEventJPanel = new JPanel(); traceEventJPanel.setLayout(new GridBagLayout()); int eventIndex = 0; int eventTypeIndex = 0; for (TraceEventType traceEventType : traceTableModel.getTraceEventTypeList()) { CheckBoxMenuItemPopupEntry<TraceEventKey> cbmipe = traceTableModel.getCheckBoxMenuItem(traceEventType); if (cbmipe.isVisible()) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.weightx = 1.0D; gbc.weighty = 0.0D; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(0, 0, 0, 0); CheckBoxLabelMenuItem<TraceEventKey> cblmi; cblmi = new CheckBoxLabelMenuItem<TraceEventKey>(cbmipe, true); checkBoxLabelMenuItemList.add(cblmi); if (traceEventType.isEventType()) { gbc.gridy = eventTypeIndex; traceEventTypesJPanel.add(cblmi, gbc); eventTypeIndex++; } else { gbc.gridy = eventIndex; traceEventJPanel.add(cblmi, gbc); eventIndex++; } } } Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); traceEventJPanel.setBorder(BorderFactory.createTitledBorder(loweredetched, "Events")); traceEventTypesJPanel.setBorder(BorderFactory.createTitledBorder(loweredetched, "Event Types")); GridBagConstraints gbc1 = new GridBagConstraints(); gbc1.gridx = 0; gbc1.gridy = 0; gbc1.weightx = 1.0D; gbc1.weighty = 1.0D; gbc1.fill = GridBagConstraints.BOTH; gbc1.anchor = GridBagConstraints.NORTHWEST; gbc1.insets = new Insets(0, 0, 0, 0); GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.gridx = 0; gbc2.gridy = 1; gbc2.weightx = 1.0D; gbc2.weighty = 1.0D; gbc2.fill = GridBagConstraints.BOTH; gbc2.anchor = GridBagConstraints.NORTHWEST; gbc2.insets = new Insets(0, 0, 0, 0); checkBoxLabelMenuItemListJPanel.add(traceEventJPanel, gbc1); checkBoxLabelMenuItemListJPanel.add(traceEventTypesJPanel, gbc2); revalidate(); repaint(); }
Example 12
Source File: TracerDataMainPanel.java From pega-tracerviewer with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") public TracerDataMainPanel(File selectedFile, RecentFileContainer recentFileContainer, TracerViewerSetting tracerViewerSetting) { super(); this.recentFileContainer = recentFileContainer; this.tracerViewerSetting = tracerViewerSetting; String charset = tracerViewerSetting.getCharset(); this.recentFile = recentFileContainer.getRecentFile(selectedFile, charset); SearchData<TraceEventKey> searchData = new SearchData<>(SearchEventType.values()); this.traceTableModel = new TraceTableModel(recentFile, searchData); BookmarkContainer<TraceEventKey> bookmarkContainer; bookmarkContainer = (BookmarkContainer<TraceEventKey>) recentFile.getAttribute(RecentFile.KEY_BOOKMARK); if (bookmarkContainer == null) { bookmarkContainer = new BookmarkContainer<TraceEventKey>(); recentFile.setAttribute(RecentFile.KEY_BOOKMARK, bookmarkContainer); } bookmarkContainer = (BookmarkContainer<TraceEventKey>) recentFile.getAttribute(RecentFile.KEY_BOOKMARK); BookmarkModel<TraceEventKey> bookmarkModel = new BookmarkModel<TraceEventKey>(bookmarkContainer, traceTableModel); traceTableModel.setBookmarkModel(bookmarkModel); traceNavigationTableController = new TraceNavigationTableController(traceTableModel); tracerDataViewMap = new HashMap<String, TracerDataView>(); traceTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent tableModelEvent) { updateDisplayJPanel(); } }); setLayout(new GridBagLayout()); GridBagConstraints gbc1 = new GridBagConstraints(); gbc1.gridx = 0; gbc1.gridy = 0; gbc1.weightx = 1.0D; gbc1.weighty = 0.0D; gbc1.fill = GridBagConstraints.BOTH; gbc1.anchor = GridBagConstraints.NORTHWEST; gbc1.insets = new Insets(0, 0, 0, 0); GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.gridx = 0; gbc2.gridy = 1; gbc2.weightx = 1.0D; gbc2.weighty = 1.0D; gbc2.fill = GridBagConstraints.BOTH; gbc2.anchor = GridBagConstraints.NORTHWEST; gbc2.insets = new Insets(0, 0, 0, 0); JPanel utilityCompositeJPanel = getUtilityCompositeJPanel(); JPanel tracerDataViewCardJPanel = getTracerDataViewCardJPanel(); add(utilityCompositeJPanel, gbc1); add(tracerDataViewCardJPanel, gbc2); // set default view JComboBox<TracerDataViewMode> tracerDataViewModeJComboBox = getTracerDataViewModeJComboBox(); // http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4699927 // tree need to be built once the root node has some child nodes. hence // setting the default to single table tracerDataViewModeJComboBox.setSelectedItem(TracerDataViewMode.SINGLE_TABLE); loadFile(traceTableModel, this, false); }
Example 13
Source File: ChatLounge.java From megamek with GNU General Public License v2.0 | 4 votes |
private void setupMainPanel() { setupMap(); panMain = new JPanel(); // layout GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); panMain.setLayout(gridbag); c.fill = GridBagConstraints.VERTICAL; c.insets = new Insets(1, 1, 1, 1); c.gridx = 0; c.gridy = 0; c.weightx = 0.0; c.weighty = 0.0; c.gridwidth = 1; gridbag.setConstraints(butOptions, c); panMain.add(butOptions); JPanel panel1 = new JPanel(new GridBagLayout()); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0.0; c.anchor = GridBagConstraints.WEST; panel1.add(lblMapSummary, c); c.anchor = GridBagConstraints.WEST; c.gridx = 1; c.weightx = 0; c.fill = GridBagConstraints.NONE; c.insets = new Insets(0, 0, 0, 20); panel1.add(lblGameYear, c); c.gridx = 2; panel1.add(lblTechLevel, c); c.insets = new Insets(0, 0, 0, 0); c.fill = GridBagConstraints.VERTICAL; c.gridx = 3; c.gridy = 0; c.weightx = 0; c.weighty = 0.0; c.anchor = GridBagConstraints.NORTHEAST; panel1.add(butCompact, c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 0; c.weightx = 0.0; c.weighty = 0.0; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHEAST; panMain.add(panel1, c); c.fill = GridBagConstraints.BOTH; c.gridx = 1; c.gridy = 1; c.weightx = 1.0; c.weighty = 1.0; c.gridwidth = 1; c.gridheight = 3; gridbag.setConstraints(scrEntities, c); panMain.add(scrEntities); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; c.weightx = 0.0; c.weighty = 0.0; c.gridwidth = 1; c.gridheight = 1; c.anchor = GridBagConstraints.NORTHWEST; gridbag.setConstraints(panUnitInfo, c); panMain.add(panUnitInfo); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 2; c.weightx = 0.0; c.weighty = 0.0; c.gridwidth = 1; c.gridheight = 1; gridbag.setConstraints(panPlayerInfo, c); panMain.add(panPlayerInfo); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 3; c.weightx = 0.0; c.weighty = 1.0; c.gridwidth = 1; c.gridheight = 1; gridbag.setConstraints(scrPlayers, c); panMain.add(scrPlayers); panTabs.add("Select Units", panMain); //$NON-NLS-1$ panTabs.add("Select Map", panMap); //$NON-NLS-1$ }
Example 14
Source File: RandomMapDialog.java From megamek with GNU General Public License v2.0 | 4 votes |
private JPanel setupTopPanel() { GridBagLayout layout = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); JPanel panel = new JPanel(layout); constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.NORTHWEST; constraints.insets = new Insets(2, 2, 2, 2); // Row 1, Column 1. constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 4; JPanel displayOptionsPanel = setupDisplayButtons(); panel.add(displayOptionsPanel, constraints); // Row 2, Column 1. constraints.gridx = 0; constraints.gridy++; constraints.gridwidth = 1; panel.add(mapSizeLabel, constraints); // Row 2, Column 2. constraints.gridx++; mapWidthField.setSelectAllTextOnGotFocus(true); mapWidthField.setRequired(true); mapWidthField.setText(String.valueOf(mapSettings.getBoardWidth())); mapWidthField.addVerifier(new VerifyIsPositiveInteger()); mapWidthField.setToolTipText(Messages.getString("RandomMapDialog.mapWidthField.toolTip")); panel.add(mapWidthField, constraints); // Row 2, Column 3. constraints.gridx++; panel.add(mapSizeSeperatorLabel, constraints); // Row 2, Column 4. constraints.gridx++; mapHeightField.setSelectAllTextOnGotFocus(true); mapHeightField.setRequired(true); mapHeightField.setText(String.valueOf(mapSettings.getBoardHeight())); mapHeightField.addVerifier(new VerifyIsPositiveInteger()); mapHeightField.setToolTipText(Messages.getString("RandomMapDialog.mapHeightField.toolTip")); panel.add(mapHeightField, constraints); // Row 3, Column 1. constraints.gridx = 0; constraints.gridy++; panel.add(mapThemeLabel, constraints); // Row 3, Column 2. constraints.gridx++; constraints.gridwidth = 3; choTheme.addActionListener(this); choTheme.setToolTipText(Messages.getString("RandomMapDialog.mapThemeField.toolTip")); panel.add(choTheme, constraints); return panel; }
Example 15
Source File: ChipsterAnnotationsScreen.java From chipster with MIT License | 4 votes |
@SuppressWarnings("serial") public ChipsterAnnotationsScreen(AnnotationManager annotations) { SwingClientApplication.setPlastic3DLookAndFeel(frame); frame.setPreferredSize(new Dimension(640, 480)); frame.setLocationByPlatform(true); this.annotations = annotations; table = this.getTable(); // Blue selection causes lot of visual problems, and there isn't // any meening for the selection table.setSelectionBackground(table.getBackground()); table.setSelectionForeground(table.getForeground()); JScrollPane tableScroller = new JScrollPane(table); closeButton = new JButton("Close"); closeButton.addActionListener(this); closeButton.setPreferredSize(BUTTON_SIZE); detailsScroller = new JScrollPane(detailsTextArea); detailsButton = new JButton("Show Details"); // to make sure that details get enough area detailsScroller.setMinimumSize(new Dimension(0, 200)); detailsScroller.setVisible(false); detailsTextArea.setEditable(false); detailsButton.addActionListener(this); detailsButton.setPreferredSize(BUTTON_SIZE); detailsButton.setEnabled(false); frame.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0; c.gridy = 0; c.gridwidth = 4; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; frame.add(tableScroller, c); c.gridy++; // c.gridx=3; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_END; c.insets.bottom = 8; c.insets.right = 8; c.insets.top = 8; frame.add(closeButton, c); frame.pack(); }
Example 16
Source File: OldCRUDMethodsPanel.java From mobile-persistence with MIT License | 4 votes |
public OldCRUDMethodsPanel() { // GridBagConstraints(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty // , int anchor, int fill, Insets insets, int ipadx, int ipady) // Insets(int top, int left, int bottom, int right) doilist.addActionListener(this); setLayout(new BorderLayout(0, 15)); JPanel contentPanel = new JPanel(); add(contentPanel, BorderLayout.NORTH); GridBagLayout containerLayout = new GridBagLayout(); contentPanel.setLayout(containerLayout); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 0, 5, 5); contentPanel.add(doiLabel, gbc); gbc.gridx++; contentPanel.add(doilist, gbc); gbc.gridy++; gbc.gridx = 0; contentPanel.add(findMethodLabel, gbc); gbc.gridx++; contentPanel.add(findMethodField, gbc); gbc.gridy++; gbc.gridx = 0; contentPanel.add(createMethodLabel, gbc); gbc.gridx++; contentPanel.add(createMethodField, gbc); gbc.gridy++; gbc.gridx = 0; contentPanel.add(updateMethodLabel, gbc); gbc.gridx++; contentPanel.add(updateMethodField, gbc); gbc.gridy++; gbc.gridx = 0; contentPanel.add(mergeMethodLabel, gbc); gbc.gridx++; contentPanel.add(mergeMethodField, gbc); gbc.gridy++; gbc.gridx = 0; contentPanel.add(deleteMethodLabel, gbc); gbc.gridx++; contentPanel.add(deleteMethodField, gbc); // gbc.weightx = 1.0f; // gbc.insets = new Insets(0, 0, 5, 0); }
Example 17
Source File: AdditionalFiltersStep.java From kieker with Apache License 2.0 | 4 votes |
private void addAndLayoutComponents() { this.setLayout(new GridBagLayout()); final GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 1.0; gridBagConstraints.fill = GridBagConstraints.BOTH; this.add(this.infoLabel, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.gridwidth = 1; gridBagConstraints.weightx = 0.0; this.add(this.selectOnlyTraces, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; this.add(this.selectOnlyTracesInput, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.gridwidth = 1; gridBagConstraints.weightx = 0.0; this.add(this.filterTraces, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; this.add(this.filterTracesInput, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.gridwidth = 1; gridBagConstraints.weightx = 0.0; this.add(this.ignoreBefore, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; this.add(this.ignoreBeforeInput, gridBagConstraints); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.fill = GridBagConstraints.VERTICAL; gridBagConstraints.gridwidth = 1; gridBagConstraints.weightx = 0.0; this.add(this.ignoreAfter, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.anchor = GridBagConstraints.EAST; gridBagConstraints.insets.set(5, 5, 5, 5); gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; this.add(this.ignoreAfterInput, gridBagConstraints); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagConstraints.weighty = 1.0; gridBagConstraints.fill = GridBagConstraints.VERTICAL; this.add(this.expandingPanel, gridBagConstraints); }
Example 18
Source File: ExportLegendImageAction.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private void initUI() { final JButton previewButton = new JButton("Preview..."); previewButton.setMnemonic('v'); previewButton.addActionListener(e -> showPreview()); final GridBagConstraints gbc = new GridBagConstraints(); final JPanel p = GridBagUtils.createPanel(); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 0; gbc.gridy = 0; gbc.gridwidth = 2; p.add(usingHeaderParam.getEditor().getEditorComponent(), gbc); gbc.gridy++; gbc.gridwidth = 1; p.add(headerTextParam.getEditor().getLabelComponent(), gbc); p.add(headerTextParam.getEditor().getEditorComponent(), gbc); gbc.gridy++; gbc.insets.top = 10; p.add(orientationParam.getEditor().getLabelComponent(), gbc); p.add(orientationParam.getEditor().getEditorComponent(), gbc); gbc.gridy++; gbc.insets.top = 3; p.add(fontSizeParam.getEditor().getLabelComponent(), gbc); p.add(fontSizeParam.getEditor().getEditorComponent(), gbc); gbc.gridy++; gbc.insets.top = 10; p.add(foregroundColorParam.getEditor().getLabelComponent(), gbc); p.add(foregroundColorParam.getEditor().getEditorComponent(), gbc); gbc.gridy++; gbc.insets.top = 3; p.add(backgroundColorParam.getEditor().getLabelComponent(), gbc); p.add(backgroundColorParam.getEditor().getEditorComponent(), gbc); gbc.gridy++; gbc.insets.top = 3; p.add(backgroundTransparencyParam.getEditor().getLabelComponent(), gbc); p.add(backgroundTransparencyParam.getEditor().getEditorComponent(), gbc); gbc.gridy++; gbc.insets.top = 10; gbc.gridx = 0; gbc.anchor = GridBagConstraints.NORTHWEST; p.add(antialiasingParam.getEditor().getEditorComponent(), gbc); gbc.insets.top = 10; gbc.gridx = 1; gbc.anchor = GridBagConstraints.NORTHEAST; p.add(previewButton, gbc); p.setBorder(new EmptyBorder(7, 7, 7, 7)); setContent(p); }
Example 19
Source File: GeneratorSettingsPanel.java From mobile-persistence with MIT License | 4 votes |
public GeneratorSettingsPanel() { // GridBagConstraints(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty // , int anchor, int fill, Insets insets, int ipadx, int ipady) // Insets(int top, int left, int bottom, int right) projectList.setModel(new DefaultComboBoxModel(projects.keySet().toArray())); setLayout( new BorderLayout( 0,15 ) ); JPanel contentPanel = new JPanel(); add( contentPanel, BorderLayout.NORTH ); GridBagLayout containerLayout = new GridBagLayout(); contentPanel.setLayout(containerLayout); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 0, 5, 5); contentPanel.add(projectLabel, gbc); gbc.gridy++; contentPanel.add(packageLabel, gbc); gbc.gridy++; contentPanel.add(servicePackageLabel, gbc); gbc.gridy++; contentPanel.add(overwriteDataObjectsLabel, gbc); gbc.gridy++; contentPanel.add(overwriteServiceObjectsLabel, gbc); gbc.gridy++; // contentPanel.add(usageTrackingLabel, gbc); // gbc.gridy++; // add(_lbAuthor, gbc); gbc.gridy = 0; gbc.gridx++; gbc.weightx = 1.0f; gbc.insets = new Insets(0, 0, 5, 0); contentPanel.add(projectList, gbc); gbc.gridy++; contentPanel.add(packageField, gbc); gbc.gridy++; contentPanel.add(servicePackageField, gbc); gbc.gridy++; contentPanel.add(overwriteDataObjectsField, gbc); gbc.gridy++; contentPanel.add(overwriteServiceObjectsField, gbc); gbc.gridy++; // contentPanel.add(usageTrackingField, gbc); // gbc.gridy++; // add(_tfAuthor, gbc); }
Example 20
Source File: TaskImportDialog.java From chipster with MIT License | 4 votes |
public TaskImportDialog(ClientApplication application, String title, ImportSession importSession, Operation importOperation, String okButtonText, String cancelButtonText, String skipButtonText, String noteText) throws MicroarrayException { super(Session.getSession().getFrames().getMainFrame(), true); this.application = application; this.importSession = importSession; this.importOperation = importOperation; this.setTitle("Import"); this.setModal(true); this.setPreferredSize(new Dimension(500, 300)); // initialise components titleLabel = new JLabel("<html><p style=" + VisualConstants.HTML_DIALOG_TITLE_STYLE + ">" + title + "</p></html>"); descriptionLabel = new JLabel("<html>" + importOperation.getDescription() + "</html>"); noteLabel = new JLabel("<html><p style=\"font-style:italic\">" + noteText + "</p></html>"); folderNameCombo = new JComboBox(ImportUtils.getFolderNames(false).toArray()); folderNameCombo.setEditable(true); okButton = new JButton(okButtonText); okButton.setPreferredSize(BUTTON_SIZE); okButton.addActionListener(this); skipButton = new JButton(skipButtonText); skipButton.setPreferredSize(BUTTON_SIZE); skipButton.addActionListener(this); cancelButton = new JButton(cancelButtonText); cancelButton.setPreferredSize(BUTTON_SIZE); cancelButton.addActionListener(this); ImportParameterPanel parameterPanel = new ImportParameterPanel(importOperation, null); JPanel keepButtonsRightPanel = new JPanel(new GridBagLayout()); GridBagConstraints buttonConstraints = new GridBagConstraints(); buttonConstraints.weightx = 1.0; buttonConstraints.weighty = 1.0; buttonConstraints.anchor = GridBagConstraints.EAST; buttonConstraints.insets.set(0, 0, 0, 8); keepButtonsRightPanel.add(cancelButton, buttonConstraints); if (importSession != null) { buttonConstraints.anchor = GridBagConstraints.CENTER; keepButtonsRightPanel.add(skipButton, buttonConstraints); } buttonConstraints.gridx = GridBagConstraints.RELATIVE; buttonConstraints.insets.set(0, 0, 0, 0); keepButtonsRightPanel.add(okButton, buttonConstraints); // layout GridBagConstraints c = new GridBagConstraints(); this.setLayout(new GridBagLayout()); // title label c.weightx = 1.0; c.weighty = 1.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.insets.set(10, 10, 5, 10); c.gridx = 0; c.gridy = 0; this.add(titleLabel, c); // description label c.gridy++; this.add(descriptionLabel, c); // parameter panel c.gridy++; c.weighty = 120.0; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTHWEST; c.insets.set(0, 10, 10, 10); this.add(parameterPanel, c); // note c.gridy++; c.weightx = 1.0; c.weighty = 1.0; c.insets.set(0, 10, 10, 10); c.fill = GridBagConstraints.HORIZONTAL; this.add(noteLabel, c); // buttons c.insets.set(10, 10, 10, 10); c.anchor = GridBagConstraints.SOUTHEAST; c.gridy++; c.fill = GridBagConstraints.NONE; this.add(keepButtonsRightPanel, c); // make visible this.pack(); Session.getSession().getFrames().setLocationRelativeToMainFrame(this); this.setVisible(true); }