Java Code Examples for java.awt.GridBagConstraints#HORIZONTAL
The following examples show how to use
java.awt.GridBagConstraints#HORIZONTAL .
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: ProgressPanel.java From netbeans with Apache License 2.0 | 6 votes |
/** Creates new form ProgressPanel */ public ProgressPanel() { initComponents(); handle = ProgressHandleFactory.createHandle( NbBundle.getMessage(ImportProjectAction.class, "CTL_ProgressDialogTitle")); // NOI18N progress = ProgressHandleFactory.createProgressComponent(handle); setLayout(new GridBagLayout()); setPreferredSize(new Dimension(450, 80)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new Insets(0, 5, 0, 5); add(progress, gridBagConstraints); }
Example 2
Source File: OptionMenu.java From Math-Game with Apache License 2.0 | 6 votes |
/** * Initializes the difficulty panel */ private void initDiffs() { diffs = new ArrayList<JRadioButton>(); for (String s : diffNames) { diffs.add(new JRadioButton(s)); } diffPanel = new JPanel(); diffGroup = new ButtonGroup(); diffPanel.setLayout(new GridBagLayout()); diffPanel.setOpaque(false); for (int i = 0; i < diffs.size(); i++) { diffGroup.add(diffs.get(i)); diffs.get(i).setFont(eurostile24); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = i; // Layout buttons going down same column diffPanel.add(diffs.get(i), gbc); buttonMap.put(diffNames[i], diffs.get(i)); diffs.get(i).setOpaque(false); // diffs.get(i).addActionListener(this); } }
Example 3
Source File: ServerGUI.java From Ogar2-Server with GNU General Public License v3.0 | 5 votes |
public static void spawn(OgarServer server) { JFrame frame = new JFrame(); frame.setLayout(new GridBagLayout()); frame.setTitle("Ogar Server 2"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextArea console = new JTextArea(40, 120); console.setFont(new Font("monospaced", Font.PLAIN, 12)); console.setEditable(false); JScrollPane scrollPane = new JScrollPane(console); JTextField textField = new JTextField(); textField.addActionListener((event) -> { server.handleCommand(textField.getText()); textField.setText(""); }); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weighty = 1.0; frame.getContentPane().add(scrollPane, c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.0; c.weighty = 0.0; frame.getContentPane().add(textField, c); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); redirectOutputStreams(console); spawned = true; }
Example 4
Source File: ComponentPanel.java From quickfix-messenger with BSD 3-Clause "New" or "Revised" License | 5 votes |
private GridBagConstraints createGridBagConstraints() { GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 0.0; c.gridx = 0; c.gridy = GridBagConstraints.RELATIVE; return c; }
Example 5
Source File: ViewElementFilename.java From Robot-Overlord-App with GNU General Public License v2.0 | 5 votes |
public ViewElementFilename(RobotOverlord ro,StringEntity e) { super(ro); this.e=e; //this.setBorder(BorderFactory.createLineBorder(Color.RED)); field = new JTextField(15); field.setEditable(false); field.setText(e.get()); field.setMargin(new Insets(1,0,1,0)); //pathAndFileName.setBorder(BorderFactory.createLoweredBevelBorder()); JLabel label=new JLabel(e.getName(),JLabel.LEADING); label.setLabelFor(field); JButton choose = new JButton("..."); choose.addActionListener(this); choose.setMargin(new Insets(0, 5, 0, 5)); choose.addFocusListener(this); panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx=0; gbc.gridy=0; gbc.fill = GridBagConstraints.HORIZONTAL; //gbc.gridheight = GridBagConstraints.REMAINDER; gbc.insets.right=5; panel.add(label,gbc); gbc.weightx=1; gbc.insets.left=0; gbc.insets.right=0; panel.add(field,gbc); gbc.weightx=0; panel.add(choose,gbc); }
Example 6
Source File: JPanelContainer.java From mts with GNU General Public License v3.0 | 5 votes |
public void clean(){ this.removeAll(); GridBagConstraints gridBagConstraintsTest = new GridBagConstraints(); gridBagConstraintsTest.fill = GridBagConstraints.HORIZONTAL; gridBagConstraintsTest.gridx = 0; gridBagConstraintsTest.gridwidth = 1; gridBagConstraintsTest.weightx = 1; this.add(new JPanelColumn(), gridBagConstraintsTest); }
Example 7
Source File: ListView.java From Raccoon with Apache License 2.0 | 5 votes |
public ListView() { setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 0, 10, 0); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = GridBagConstraints.REMAINDER; // We don't stretch aand depending on the LAF, the underlying container // might have a different color. setOpaque(false); }
Example 8
Source File: HardLayoutPane.java From DroidUIBuilder with Apache License 2.0 | 4 votes |
/** * 添加一个组件到固定面板上. * * @param willBeAddTo 要加入的组件 * @param comWidth 组件自定义高度 * @param comWidth 组件自定义宽度 * @param gridX 水平方向上网格跨度 * @param gridY 垂直方向上网格跨度 * @param gridWidth 水平方向上占据的网格跨度 * @param gridHeight 水平方向上占据的网格跨度 * * 组件填充方式的确定:<br> * 如果组件的宽度小于0且高度也小于0,填充方式为双向,否则<br> * 如果组件的宽度小于0,填充方式为水平方向;如果等于零,则不进行填充,否则<br> * 如果组件的高度小于0,填充方式为垂直方向。 * @see GridBagConstraints */ public void addTo(JComponent willBeAddTo,int comWidth, int comHeight,int gridX,int gridY, int gridWidth,int gridHeight) { gbc.gridx = gridX; gbc.gridy = gridY; gbc.gridwidth = gridWidth; gbc.gridheight = gridHeight; gbc.weightx = 0.0; gbc.weighty = 0.0; if ( comWidth <0 && comHeight <0 ) { gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; } else if (comWidth <=0) { if ( comWidth == 0 ) gbc.fill = GridBagConstraints.NONE; else { gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; } } else if (comHeight <0 ) { gbc.weighty = 1.0; gbc.fill = GridBagConstraints.VERTICAL; } else { gbc.fill = GridBagConstraints.NONE; willBeAddTo.setPreferredSize(new Dimension(comWidth,comHeight)); } //需要增加“回车移动焦点到下一组件上”监听事件 if (addEnterKeyTrasfer) //给其它组件增加(文本组件已经UI里实现了 addEnterKeyTransferFocusImplExceptText(willBeAddTo); this.fixedSubPane.add(willBeAddTo,gbc); }
Example 9
Source File: GeneralToolsPanel.java From wpcleaner with Apache License 2.0 | 4 votes |
/** * Initialize the panel. */ private void initialize() { // Initialize constraints GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridheight = 1; constraints.gridwidth = 1; constraints.gridx = 0; constraints.gridy = 0; constraints.insets = new Insets(0, 0, 0, 0); constraints.ipadx = 0; constraints.ipady = 0; constraints.weightx = 1; constraints.weighty = 0; // Automatic disambiguation fixing buttonAutomaticFixing = Utilities.createJButton( "commons-disambig-colour.png", EnumImageSize.NORMAL, GT._T("Semi-automatic disambiguation fixing"), true, null); buttonAutomaticFixing.addActionListener(EventHandler.create( ActionListener.class, this, "actionAutomaticFixing")); add(buttonAutomaticFixing, constraints); constraints.gridy++; // Update disambiguation warning buttonUpdateDabWarning = Utilities.createJButton( "commons-disambig-colour.png", EnumImageSize.NORMAL, GT._T("Update existing disambiguation warning messages"), true, null); buttonUpdateDabWarning.addActionListener(EventHandler.create( ActionListener.class, this, "actionUpdateDabWarning")); add(buttonUpdateDabWarning, constraints); constraints.gridy++; // Update ISBN warning buttonUpdateISBNWarning = Utilities.createJButton( "commons-nuvola-web-broom.png", EnumImageSize.NORMAL, GT._T("Update {0} warning messages", "ISBN"), true, null); buttonUpdateISBNWarning.addActionListener(EventHandler.create( ActionListener.class, this, "actionUpdateISBNWarning")); add(buttonUpdateISBNWarning, constraints); constraints.gridy++; // List ISBN errors buttonListISBNError = Utilities.createJButton( "commons-nuvola-web-broom.png", EnumImageSize.NORMAL, GT._T("List {0} errors", "ISBN"), true, null); buttonListISBNError.addActionListener(EventHandler.create( ActionListener.class, this, "actionListISBNErrors")); add(buttonListISBNError, constraints); constraints.gridy++; // Update ISSN warning buttonUpdateISSNWarning = Utilities.createJButton( "commons-nuvola-web-broom.png", EnumImageSize.NORMAL, GT._T("Update {0} warning messages", "ISSN"), true, null); buttonUpdateISSNWarning.addActionListener(EventHandler.create( ActionListener.class, this, "actionUpdateISSNWarning")); add(buttonUpdateISSNWarning, constraints); constraints.gridy++; // List ISSN errors buttonListISSNError = Utilities.createJButton( "commons-nuvola-web-broom.png", EnumImageSize.NORMAL, GT._T("List {0} errors", "ISSN"), true, null); buttonListISSNError.addActionListener(EventHandler.create( ActionListener.class, this, "actionListISSNErrors")); add(buttonListISSNError, constraints); constraints.gridy++; // Update duplicate arguments warning buttonUpdateDuplicateArgsWarning = Utilities.createJButton( "commons-nuvola-web-broom.png", EnumImageSize.NORMAL, GT._T("Update duplicate argument warning messages"), true, null); buttonUpdateDuplicateArgsWarning.addActionListener(EventHandler.create( ActionListener.class, this, "actionUpdateDuplicateArgsWarning")); add(buttonUpdateDuplicateArgsWarning, constraints); constraints.gridy++; // Monitor recent changes buttonMonitorRC = Utilities.createJButton( "commons-nuvola-apps-kcmsystem.png", EnumImageSize.NORMAL, GT._T("Monitor recent changes"), true, null); buttonMonitorRC.addActionListener(EventHandler.create( ActionListener.class, this, "actionMonitorRC")); add(buttonMonitorRC, constraints); constraints.gridy++; // Empty panel JPanel panel = new JPanel(); constraints.weighty = 1; add(panel, constraints); constraints.gridy++; }
Example 10
Source File: GridBagPanel.java From scelight with Apache License 2.0 | 4 votes |
@Override public void defaultConstraints() { c.anchor = GridBagConstraints.LINE_START; c.fill = GridBagConstraints.HORIZONTAL; c.insets.set( 2, 1, 2, 1 ); }
Example 11
Source File: AquaOpenLocationPaneUI.java From pumpernickel with MIT License | 4 votes |
@Override protected void installGUI(JComponent panel) { panel.addPropertyChangeListener(KEY_INCLUDE_SIDEBAR, propertyChangeListener); if (sourceList.isEmpty()) { File[] array1 = CommonFiles.getUserDirectories(true); IOLocation[] array2 = new FileLocation[array1.length]; for (int a = 0; a < array1.length; a++) { array2[a] = LocationFactory.get().create(array1[a]); } sourceList.add(array2); } boolean includeSidebar = getBoolean(locationPane, KEY_INCLUDE_SIDEBAR, true); boolean includeFooter = getBoolean(locationPane, KEY_INCLUDE_FOOTER, true); panel.removeAll(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(4, 0, 4, 0); panel.add(controls, c); c.gridy++; c.weighty = 1; c.fill = GridBagConstraints.BOTH; if (includeSidebar) { splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sourceListScrollPane, browser); panel.add(splitPane, c); } else { panel.add(browser, c); } if (includeFooter) { c.weighty = 0; c.gridy++; panel.add(footer, c); } sourceListScrollPane.setMinimumSize(new Dimension(100, 40)); sourceListScrollPane.setPreferredSize(new Dimension(150, 40)); }
Example 12
Source File: SelectDataControlPanel.java From mobile-persistence with MIT License | 4 votes |
public SelectDataControlPanel() { super(); setLayout(new BorderLayout(0, 15)); JPanel contentPanel = new JPanel(); add(contentPanel, BorderLayout.NORTH); contentPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 0, 5, 5); contentPanel.add(dclabel, gbc); // gbc.gridy++; // add(_lbName, 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(dclist, gbc); gbc.gridy++; // add(_tfName, gbc); // gbc.gridy++; // add(_tfAuthor, gbc); List<DataControl> dataControls = DataControlManager.getInstance().getAllDataControls(); for (DataControl dc: dataControls) { if (dc.getRealDataControl() instanceof JUDTAdapterDataControl) { JUDTAdapterDataControl adc = (JUDTAdapterDataControl) dc.getRealDataControl(); String implClass = adc.getDef().getClass().getName(); if (implClass.endsWith("WSDefinition") || implClass.endsWith("RestURLDCDefinition") || implClass.endsWith("RestDCDefinition")) { // Only add web service data controls dataControlMap.put(dc.getId(), dc); dclist.addItem(dc.getId()); } } } }
Example 13
Source File: CtrlBar.java From allsummarizer with Apache License 2.0 | 4 votes |
public CtrlBar(){ super(); GridBagLayout gbl = new GridBagLayout(); gbl.columnWidths = new int[]{265, 267, 340, 0}; gbl.rowHeights = new int[]{0, 0, 0}; gbl.columnWeights = new double[]{1.0, 1.0, 0.0, Double.MIN_VALUE}; gbl.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE}; this.setLayout(gbl); //----------------- Line = 0 ----------------- // Column = 0 JLabel lblThrshold = new JLabel("Clustering Threshold %"); GridBagConstraints gbc_x0y0 = new GridBagConstraints(); gbc_x0y0.insets = new Insets(0, 0, 5, 5); gbc_x0y0.gridx = 0; gbc_x0y0.gridy = 0; this.add(lblThrshold, gbc_x0y0); // Column = 1 JLabel lblSummUnit = new JLabel("Summarization unit"); GridBagConstraints gbc_x1y0 = new GridBagConstraints(); gbc_x1y0.insets = new Insets(0, 0, 5, 5); gbc_x1y0.gridx = 1; gbc_x1y0.gridy = 0; this.add(lblSummUnit, gbc_x1y0); // Column = 2 JLabel lblSummRate = new JLabel("Summarization ratio %"); GridBagConstraints gbc_x2y0 = new GridBagConstraints(); gbc_x2y0.insets = new Insets(0, 0, 5, 0); gbc_x2y0.gridx = 2; gbc_x2y0.gridy = 0; this.add(lblSummRate, gbc_x2y0); //----------------- Line = 1 ----------------- // Column = 0 clusterThreshold = new JSpinner(new SpinnerNumberModel(50, 0, 100, 5)); GridBagConstraints gbc_spinner = new GridBagConstraints(); gbc_spinner.insets = new Insets(0, 0, 0, 5); gbc_spinner.gridx = 0; gbc_spinner.gridy = 1; this.add(clusterThreshold, gbc_spinner); // Column = 1 JComboBox<String> comboBox = new JComboBox<String>(); comboBox.setModel(new DefaultComboBoxModel<String>(new String[] {"Characters", "Words", "Sentences"})); GridBagConstraints gbc_x1y1 = new GridBagConstraints(); gbc_x1y1.insets = new Insets(0, 0, 0, 5); gbc_x1y1.fill = GridBagConstraints.HORIZONTAL; gbc_x1y1.gridx = 1; gbc_x1y1.gridy = 1; this.add(comboBox, gbc_x1y1); // Column = 2 summaryRate = new JSpinner(new SpinnerNumberModel(20, 1, 50, 1)); GridBagConstraints gbc_x2y1 = new GridBagConstraints(); gbc_x2y1.gridx = 2; gbc_x2y1.gridy = 1; this.add(summaryRate, gbc_x2y1); }
Example 14
Source File: Font2DTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private void setupPanel() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; gbc.insets = new Insets( 2, 0, 2, 2 ); this.setLayout( gbl ); addLabeledComponentToGBL( "Font: ", fontMenu, gbl, gbc, this ); addLabeledComponentToGBL( "Size: ", sizeField, gbl, gbc, this ); gbc.gridwidth = GridBagConstraints.REMAINDER; addLabeledComponentToGBL( "Font Transform:", transformMenu, gbl, gbc, this ); gbc.gridwidth = 1; addLabeledComponentToGBL( "Range: ", rm, gbl, gbc, this ); addLabeledComponentToGBL( "Style: ", styleMenu, gbl, gbc, this ); gbc.gridwidth = GridBagConstraints.REMAINDER; addLabeledComponentToGBL( "Graphics Transform: ", transformMenuG2, gbl, gbc, this ); gbc.gridwidth = 1; gbc.anchor = GridBagConstraints.WEST; addLabeledComponentToGBL( "Method: ", methodsMenu, gbl, gbc, this ); addLabeledComponentToGBL("", null, gbl, gbc, this); gbc.anchor = GridBagConstraints.EAST; gbc.gridwidth = GridBagConstraints.REMAINDER; addLabeledComponentToGBL( "Text to use:", textMenu, gbl, gbc, this ); gbc.weightx=1; gbc.gridwidth = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; addLabeledComponentToGBL("LCD contrast: ", contrastSlider, gbl, gbc, this); gbc.gridwidth = 1; gbc.fill = GridBagConstraints.NONE; addLabeledComponentToGBL("Antialiasing: ", antiAliasMenu, gbl, gbc, this); gbc.anchor = GridBagConstraints.EAST; gbc.gridwidth = GridBagConstraints.REMAINDER; addLabeledComponentToGBL("Fractional metrics: ", fracMetricsMenu, gbl, gbc, this); gbc.weightx = 1; gbc.weighty = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets( 2, 0, 0, 2 ); gbc.fill = GridBagConstraints.BOTH; gbl.setConstraints( fp, gbc ); this.add( fp ); gbc.weighty = 0; gbc.insets = new Insets( 0, 2, 0, 0 ); gbl.setConstraints( statusBar, gbc ); this.add( statusBar ); }
Example 15
Source File: ProductIonFilterSetHighlightDialog.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public ProductIonFilterSetHighlightDialog(ProductIonFilterPlot plot, String command) { // Make dialog modal super(MZmineCore.getDesktop().getMainWindow(), "", true); this.desktop = MZmineCore.getDesktop(); this.plot = plot; this.rangeType = command; String title = "Highlight "; if (command.equals("HIGHLIGHT_PRECURSOR")) title += "precursor m/z range"; else if (command.equals("HIGHLIGHT_NEUTRALLOSS")) title += "neutral loss m/z range"; setTitle(title); GridBagConstraints constraints = new GridBagConstraints(); // set default layout constraints constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.WEST; constraints.insets = new Insets(PADDING_SIZE, PADDING_SIZE, PADDING_SIZE, PADDING_SIZE); JComponent comp; GridBagLayout layout = new GridBagLayout(); JPanel components = new JPanel(layout); NumberFormat format = NumberFormat.getNumberInstance(); comp = GUIUtils.addLabel(components, "Minimum m/z"); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 1; constraints.gridheight = 1; layout.setConstraints(comp, constraints); constraints.weightx = 1; fieldMinMZ = new JFormattedTextField(format); fieldMinMZ.setPreferredSize(new Dimension(50, fieldMinMZ.getPreferredSize().height)); constraints.gridx = 1; components.add(fieldMinMZ, constraints); constraints.weightx = 0; comp = GUIUtils.addLabel(components, "Maximum m/z"); constraints.gridx = 0; constraints.gridy = 1; layout.setConstraints(comp, constraints); constraints.weightx = 1; fieldMaxMZ = new JFormattedTextField(format); constraints.gridx = 1; components.add(fieldMaxMZ, constraints); constraints.weightx = 0; comp = GUIUtils.addSeparator(components, PADDING_SIZE); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; layout.setConstraints(comp, constraints); JPanel buttonsPanel = new JPanel(); btnOK = GUIUtils.addButton(buttonsPanel, "OK", null, this); btnCancel = GUIUtils.addButton(buttonsPanel, "Cancel", null, this); constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 3; constraints.gridheight = 1; components.add(buttonsPanel, constraints); GUIUtils.addMargin(components, PADDING_SIZE); add(components); // finalize the dialog pack(); setLocationRelativeTo(MZmineCore.getDesktop().getMainWindow()); setResizable(false); }
Example 16
Source File: FarmingTabPanel.java From plugins with GNU General Public License v3.0 | 4 votes |
FarmingTabPanel( FarmingTracker farmingTracker, ItemManager itemManager, TimeTrackingConfig config, Set<FarmingPatch> patches, FarmingContractManager farmingContractManager ) { this.farmingTracker = farmingTracker; this.itemManager = itemManager; this.config = config; this.patchPanels = new ArrayList<>(); this.farmingContractManager = farmingContractManager; setLayout(new GridBagLayout()); setBackground(ColorScheme.DARK_GRAY_COLOR); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; c.gridy = 0; PatchImplementation lastImpl = null; boolean first = true; for (FarmingPatch patch : patches) { String title = patch.getRegion().getName() + (Strings.isNullOrEmpty(patch.getName()) ? "" : " (" + patch.getName() + ")"); TimeablePanel<FarmingPatch> p = new TimeablePanel<>(patch, title, 1); /* Show labels to subdivide tabs into sections */ if (patch.getImplementation() != lastImpl && !Strings.isNullOrEmpty(patch.getImplementation().getName())) { JLabel groupLabel = new JLabel(patch.getImplementation().getName()); if (first) { first = false; groupLabel.setBorder(new EmptyBorder(4, 0, 0, 0)); } else { groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0)); } groupLabel.setFont(FontManager.getRunescapeSmallFont()); add(groupLabel, c); c.gridy++; lastImpl = patch.getImplementation(); } patchPanels.add(p); add(p, c); c.gridy++; /* This is a weird hack to remove the top border on the first tracker of every tab */ if (first) { first = false; p.setBorder(null); } } }
Example 17
Source File: GrantBuilder.java From raccoon4 with Apache License 2.0 | 4 votes |
@Override protected JPanel assemble() { String tmp = Messages.getString(Traits.rev("tuoba.esnecil")); tmp = MessageFormat.format(tmp, Bookmarks.ORDER, globals.get(Traits.class) .getChallenge().toUpperCase()); HyperTextPane about = new HyperTextPane(tmp).withTransparency().withWidth( 300); input = new JTextField(20); input.setMargin(new Insets(2, 2, 2, 2)); input.addCaretListener(this); input.addActionListener(this); go = new JButton(Messages.getString(Traits.rev("ylppa.esnecil"))); go.addActionListener(this); go.setEnabled(false); JPanel content = new JPanel(); content.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; content.add(about, gbc); gbc.gridy = 1; gbc.gridwidth = 1; gbc.insets.top = 15; gbc.weightx = 0; gbc.weighty = 0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; content.add(new JLabel(Messages.getString(Traits.rev("yek.esnecil"))), gbc); gbc.gridx = 1; gbc.weightx = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets.left = 5; content.add(input, gbc); panel = new DialogBuilder(new AdapterBuilder(content)) .withTitle(Messages.getString(Traits.rev("eltit.esnecil"))) .withSubTitle(Messages.getString(Traits.rev("eltitbus.esnecil"))) .withButtons(new ButtonBarBuilder().add(go)).build(globals); return panel; }
Example 18
Source File: PropertiesDialog.java From collect-earth with MIT License | 4 votes |
private JComponent getIntegrationsPanel() { final JPanel panel = new JPanel(new GridBagLayout()); final GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.anchor = GridBagConstraints.LINE_START; constraints.insets = new Insets(5, 5, 5, 5); constraints.weightx = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridwidth = 2; panel.add(propertyToComponent.get(EarthProperty.OPEN_GEE_CODE_EDITOR)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_GEE_APP)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_BING_MAPS)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_EARTH_MAP)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_PLANET_MAPS)[0], constraints); constraints.gridy++; constraints.gridwidth = 1; final JLabel label = new JLabel(Messages.getString("OptionWizard.101")); //$NON-NLS-1$ panel.add(label, constraints); constraints.gridx = 1; panel.add(propertyToComponent.get(EarthProperty.PLANET_MAPS_KEY)[0], constraints); constraints.gridx = 0; constraints.gridy++; constraints.gridwidth = 2; panel.add(propertyToComponent.get(EarthProperty.OPEN_MAXAR_SECUREWATCH)[0], constraints); constraints.gridy++; constraints.gridwidth = 1; final JLabel labelMaxar = new JLabel(Messages.getString("OptionWizard.1021")); //$NON-NLS-1$ panel.add(labelMaxar, constraints); constraints.gridx = 1; panel.add(propertyToComponent.get(EarthProperty.MAXAR_SECUREWATCH_URL)[0], constraints); constraints.gridx = 0; constraints.gridy++; constraints.gridwidth = 2; panel.add(propertyToComponent.get(EarthProperty.OPEN_YANDEX_MAPS)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_BAIDU_MAPS)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_STREET_VIEW)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_GEE_EXPLORER)[0], constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.OPEN_TIMELAPSE)[0], constraints); constraints.gridy++; final JLabel label2 = new JLabel(Messages.getString("OptionWizard.103")); //$NON-NLS-1$ panel.add(label2, constraints); constraints.gridy++; panel.add(propertyToComponent.get(EarthProperty.EXTRA_MAP_URL)[0], constraints); return panel; }
Example 19
Source File: ServiceDialog.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public JobAttributesPanel() { super(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); setLayout(gridbag); setBorder(BorderFactory.createTitledBorder(strTitle)); c.fill = GridBagConstraints.NONE; c.insets = compInsets; c.weighty = 1.0; cbJobSheets = createCheckBox("checkbox.jobsheets", this); c.anchor = GridBagConstraints.LINE_START; addToGB(cbJobSheets, this, gridbag, c); JPanel pnlTop = new JPanel(); lblPriority = new JLabel(getMsg("label.priority"), JLabel.TRAILING); lblPriority.setDisplayedMnemonic(getMnemonic("label.priority")); pnlTop.add(lblPriority); snModel = new SpinnerNumberModel(1, 1, 100, 1); spinPriority = new JSpinner(snModel); lblPriority.setLabelFor(spinPriority); // REMIND ((JSpinner.NumberEditor)spinPriority.getEditor()).getTextField().setColumns(3); spinPriority.addChangeListener(this); pnlTop.add(spinPriority); c.anchor = GridBagConstraints.LINE_END; c.gridwidth = GridBagConstraints.REMAINDER; pnlTop.getAccessibleContext().setAccessibleName( getMsg("label.priority")); addToGB(pnlTop, this, gridbag, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; c.weightx = 0.0; c.gridwidth = 1; char jmnemonic = getMnemonic("label.jobname"); lblJobName = new JLabel(getMsg("label.jobname"), JLabel.TRAILING); lblJobName.setDisplayedMnemonic(jmnemonic); addToGB(lblJobName, this, gridbag, c); c.weightx = 1.0; c.gridwidth = GridBagConstraints.REMAINDER; tfJobName = new JTextField(); lblJobName.setLabelFor(tfJobName); tfJobName.addFocusListener(this); tfJobName.setFocusAccelerator(jmnemonic); tfJobName.getAccessibleContext().setAccessibleName( getMsg("label.jobname")); addToGB(tfJobName, this, gridbag, c); c.weightx = 0.0; c.gridwidth = 1; char umnemonic = getMnemonic("label.username"); lblUserName = new JLabel(getMsg("label.username"), JLabel.TRAILING); lblUserName.setDisplayedMnemonic(umnemonic); addToGB(lblUserName, this, gridbag, c); c.gridwidth = GridBagConstraints.REMAINDER; tfUserName = new JTextField(); lblUserName.setLabelFor(tfUserName); tfUserName.addFocusListener(this); tfUserName.setFocusAccelerator(umnemonic); tfUserName.getAccessibleContext().setAccessibleName( getMsg("label.username")); addToGB(tfUserName, this, gridbag, c); }
Example 20
Source File: AbsoluteTimeIntervalPanel.java From nmonvisualizer with Apache License 2.0 | 4 votes |
AbsoluteTimeIntervalPanel(NMONVisualizerGui gui) { super(gui); setLayout(new BorderLayout()); add.addActionListener(addInterval); // start and end text boxes with labels, followed by a Add button startLabel = new JLabel("Start:"); startLabel.setHorizontalAlignment(SwingConstants.TRAILING); startLabel.setFont(Styles.LABEL); start = new JSpinner(new SpinnerDateModel(new Date(getDefaultStartTime()), null, null, Calendar.MINUTE)); start.setEditor(new DateEditor(start, Styles.DATE_FORMAT_STRING_WITH_YEAR)); start.addChangeListener(intervalUpdater); endLabel = new JLabel("End:"); endLabel.setHorizontalAlignment(SwingConstants.TRAILING); endLabel.setFont(Styles.LABEL); end = new JSpinner(new SpinnerDateModel(new Date(getDefaultEndTime()), null, null, Calendar.MINUTE)); end.setEditor(new DateEditor(end, Styles.DATE_FORMAT_STRING_WITH_YEAR)); end.addChangeListener(intervalUpdater); JPanel namePanel = new JPanel(); namePanel.add(nameLabel); namePanel.add(name); JPanel startPanel = new JPanel(); startPanel.add(startLabel); startPanel.add(start); JPanel endPanel = new JPanel(); endPanel.add(endLabel); endPanel.add(end); JPanel buttonsPanel = new JPanel(); buttonsPanel.add(add); buttonsPanel.add(endToStart); buttonsPanel.add(reset); JPanel dataPanel = new JPanel(); dataPanel.setLayout(new GridBagLayout()); GridBagConstraints labelConstraints = new GridBagConstraints(); GridBagConstraints fieldConstraints = new GridBagConstraints(); labelConstraints.gridx = 0; fieldConstraints.gridx = 1; labelConstraints.gridy = 0; fieldConstraints.gridy = 0; labelConstraints.insets = new Insets(0, 0, 0, 5); fieldConstraints.insets = new Insets(5, 0, 0, 5); labelConstraints.fill = GridBagConstraints.HORIZONTAL; fieldConstraints.fill = GridBagConstraints.HORIZONTAL; dataPanel.add(startLabel, labelConstraints); dataPanel.add(start, fieldConstraints); ++labelConstraints.gridy; ++fieldConstraints.gridy; dataPanel.add(endLabel, labelConstraints); dataPanel.add(end, fieldConstraints); add(namePanel, BorderLayout.PAGE_START); add(dataPanel, BorderLayout.CENTER); add(buttonsPanel, BorderLayout.PAGE_END); }