List of usage examples for java.awt Insets Insets
public Insets(int top, int left, int bottom, int right)
From source file:com.digitalgeneralists.assurance.ui.components.ScanHistoryPanel.java
private void initializeComponent() { if (!this.initialized) { GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); GridBagConstraints existingScansPanelConstraints = new GridBagConstraints(); existingScansPanelConstraints.anchor = GridBagConstraints.WEST; existingScansPanelConstraints.fill = GridBagConstraints.BOTH; existingScansPanelConstraints.gridx = 0; existingScansPanelConstraints.gridy = 0; existingScansPanelConstraints.weightx = 1.0; existingScansPanelConstraints.weighty = 1.0; existingScansPanelConstraints.gridheight = 1; existingScansPanelConstraints.gridwidth = 1; existingScansPanelConstraints.insets = new Insets(0, 0, 0, 0); this.existingScansListPanel = new ListInputPanel<Scan>(this, this, true, true); this.add(this.existingScansListPanel, existingScansPanelConstraints); this.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { applicationDelegate.addEventObserver(ScanCompletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ScansLoadedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ScanDeletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.loadScans(); }/* w ww. j ava 2s.c o m*/ public void ancestorRemoved(AncestorEvent event) { applicationDelegate.removeEventObserver(ScanCompletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ScansLoadedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ScanDeletedEvent.class, (IEventObserver) event.getSource()); } public void ancestorMoved(AncestorEvent event) { } }); this.initialized = true; } }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java
private void initialize() { GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 2;//from w w w.j a v a 2s . c o m gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints9.gridwidth = 2; gridBagConstraints9.insets = new Insets(10, 10, 0, 10); gridBagConstraints9.anchor = GridBagConstraints.NORTH; gridBagConstraints9.gridy = 0; GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.gridx = 0; gridBagConstraints7.fill = GridBagConstraints.BOTH; gridBagConstraints7.gridwidth = 2; gridBagConstraints7.insets = new Insets(0, 0, 0, 0); gridBagConstraints7.weightx = 1.0; gridBagConstraints7.anchor = GridBagConstraints.CENTER; gridBagConstraints7.weighty = 1.0; gridBagConstraints7.gridy = 0; this.setLayout(new GridBagLayout()); this.add(getJPanelValue(), gridBagConstraints7); this.add(getJPanelButtons(), gridBagConstraints9); }
From source file:com.googlecode.commons.swing.component.datetime.MiniDateCalendar.java
private void init() { final DateFormatSymbols dfs = new DateFormatSymbols(locale); CollectionUtils.addAll(this.weekdays, dfs.getShortWeekdays()); for (int i = 0; i < 7; i++) { orderedWeekdays.add(((i + weekDayStart - 1) % 7) + 1); }/*from w w w . ja v a2 s . c o m*/ setLayout(new BorderLayout()); SizeUtils.setAllWidths(this, 150); SizeUtils.setAllHeights(this, 180); panNorth = new JPanel(new BorderLayout()); add(panNorth, BorderLayout.NORTH); btnPrev = new JButton(); SizeUtils.setAllWidths(btnPrev, 18); SizeUtils.setAllHeights(btnPrev, 18); btnPrev.setIcon(DefaultIcons.resultset_previous()); btnPrev.setMargin(new Insets(0, 0, 0, 0)); btnPrev.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onClickPrev(); } }); panNorth.add(btnPrev, BorderLayout.WEST); lblMonth = new JLabel(); SizeUtils.setMinHeight(lblMonth, 0); SizeUtils.setPreferredHeight(lblMonth, 0); lblMonth.setHorizontalAlignment(SwingConstants.CENTER); panNorth.add(lblMonth, BorderLayout.CENTER); btnNext = new JButton(); btnNext.setIcon(DefaultIcons.resultset_next()); SizeUtils.setAllWidths(btnNext, 18); SizeUtils.setAllHeights(btnNext, 18); btnNext.setMargin(new Insets(0, 0, 0, 0)); btnNext.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onClickNext(); } }); panNorth.add(btnNext, BorderLayout.EAST); panCenter = new JPanel(); panCenter.setLayout(new GridLayout(7, 7)); add(panCenter, BorderLayout.CENTER); for (int col = 0; col < 7; col++) { JLabel lblDay = new JLabel(weekdays.get(orderedWeekdays.get(col))); lblDay.setHorizontalAlignment(SwingConstants.CENTER); panCenter.add(lblDay); } ButtonGroup grp = new ButtonGroup(); for (int row = 0; row < 6; row++) { for (int col = 0; col < 7; col++) { final int day = orderedWeekdays.get(col); final DayButton btn = createDayButton(day, weekdays.get(day)); btn.setMargin(new Insets(0, 0, 0, 0)); btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onClickDay(btn.value); } }); days.add(btn); grp.add(btn); panCenter.add(btn); } } refresh(); }
From source file:com.lp.client.frame.component.PanelDiagramm.java
private void jbInit() throws Throwable { this.setLayout(new GridBagLayout()); jpaWorkingOn = new JPanel(new GridBagLayout()); chartPanel = new ChartPanel(null); JPanel panelButtonAction = getToolsPanel(); getInternalFrame().addItemChangedListener(this); this.add(panelButtonAction, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); this.add(jpaWorkingOn, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); }
From source file:com.simplexrepaginator.RepaginateFrame.java
public RepaginateFrame(FileRepaginator repaginator) { super("Simplex Repaginator version " + Repaginate.getVersion()); setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.repaginator = repaginator; setJMenuBar(createMenuBar());/* www. j a v a 2s.co m*/ input = createInputButton(); repaginate = createRepaginateButton(); unrepaginate = createUnrepaginateButton(); output = creatOutputButton(); setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0); c.gridwidth = 2; add(input, c); c.gridy++; c.gridwidth = 1; c.fill = GridBagConstraints.VERTICAL; add(repaginate, c); c.gridx++; add(unrepaginate, c); c.gridy++; c.gridx = 0; c.gridwidth = 2; c.fill = GridBagConstraints.BOTH; add(output, c); Runnable r = new Runnable() { @Override public void run() { UpdateChecker uc = new UpdateChecker(); try { if (!uc.isUpdateAvailable()) return; final JLabel label = new JLabel("<html>Simplex Repaginator version " + uc.getLatestVersion() + " is available. " + "Choose <b>File > Check For Updates</b> to download."); EventQueue.invokeLater(new Runnable() { @Override public void run() { c.gridy++; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; add(label, c); revalidate(); } }); } catch (IOException ioe) { } } }; new Thread(r).start(); pack(); setSize(800, 400); }
From source file:com.game.ui.views.WeaponEditorPanel.java
public void doGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel( "<html><div style='width : 500px;'>Pls select a value to choose an Weapon or you can create a new " + "Weapon entity below. Once selected a weapon, its' details will be available below</div></html>"); noteLbl.setAlignmentX(0);/*from ww w.j a v a2 s. co m*/ add(noteLbl); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { model.addElement(((Weapon) item).getName()); } } comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setAlignmentX(0); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(Box.createVerticalStrut(10)); add(comboBox); add(Box.createVerticalStrut(10)); JPanel panel1 = new JPanel(); panel1.setAlignmentX(0); panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel1.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel weaponDtsLbl = new JLabel("Weapon Details : "); weaponDtsLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); panel1.add(weaponDtsLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); panel1.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); panel1.add(name, c); c.gridx = 0; c.gridy = 2; JLabel weaponTypeLbl = new JLabel("Weapon Type : "); panel1.add(weaponTypeLbl, c); c.gridx = 1; JComboBox weaponType = new JComboBox(Configuration.weaponTypes); weaponType.setSelectedIndex(0); weaponType.setPreferredSize(name.getPreferredSize()); System.out.println(name.getPreferredSize()); panel1.add(weaponType, c); c.gridx = 0; c.gridy = 3; JLabel attackRangeLbl = new JLabel("Attack Range : "); panel1.add(attackRangeLbl, c); c.gridx = 1; JTextField attackRange = new JTextField(""); attackRange.setColumns(20); panel1.add(attackRange, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); panel1.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); panel1.add(attackPts, c); c.gridx = 0; c.gridy = 5; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); panel1.add(submit, c); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.weighty = 0; c.weightx = 1; validationMess = new JLabel("Pls enter all the fields or pls choose a weapon from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); panel1.add(validationMess, c); // c.fill = GridBagConstraints.BOTH; // c.gridy = 7; // c.weightx = 1; // c.weighty = 1; // panel1.add(new JLabel(""), c); panel1.setBorder(LineBorder.createGrayLineBorder()); add(panel1); add(Box.createVerticalGlue()); }
From source file:ecosim.gui.SummaryPane.java
public SummaryPane(Summary summary) { this.summary = summary; setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); setLayout(new GridBagLayout()); // Setup the constraints for the GridBagLayout. GridBagConstraints northWest = new GridBagConstraints(0, 0, // gridx, gridy 1, 1, // gridwidth, gridheight 0.9D, 0.9D, // weightx, weighty GridBagConstraints.CENTER, // anchor GridBagConstraints.BOTH, // fill new Insets(0, 0, 0, 0), // insets 0, 0 // ipadx, ipady );/*w ww. j a va 2 s.c om*/ GridBagConstraints northEast = new GridBagConstraints(1, 0, // gridx, gridy 1, 1, // gridwidth, gridheight 0.1D, 0.5D, // weightx, weighty GridBagConstraints.NORTH, // anchor GridBagConstraints.HORIZONTAL, // fill new Insets(0, 0, 0, 0), // insets 0, 0 // ipadx, ipady ); GridBagConstraints south = new GridBagConstraints(0, 1, // gridx, gridy 2, 1, // gridwidth, gridheight 1.0D, 0.1D, // weightx, weighty GridBagConstraints.SOUTH, // anchor GridBagConstraints.HORIZONTAL, // fill new Insets(0, 0, 0, 0), // insets 0, 0 // ipadx, ipady ); // Add everything to the summary pane. add(makeBinningChart(), northWest); add(makeTextPane(), northEast); add(makeTablePane(), south); }
From source file:com.mirth.connect.client.ui.components.MirthIconTextField.java
@Override protected void paintComponent(Graphics g) { if (insets == null) { insets = getMargin();//from w w w . ja v a 2 s .co m if (insets == null) { insets = new Insets(0, 0, 0, 0); } } if (icon != null) { setMargin(new Insets(insets.top, insets.left + icon.getIconWidth(), insets.bottom, insets.right)); } else { setMargin(insets); } super.paintComponent(g); if (icon != null) { g.drawImage(icon.getImage(), 2, (getHeight() - icon.getIconHeight()) / 2, this); } }
From source file:net.sf.jabref.gui.preftabs.PreviewPrefsTab.java
public PreviewPrefsTab(JabRefPreferences prefs) { this.prefs = prefs; GridBagLayout layout = new GridBagLayout(); firstPanel.setLayout(layout);// w ww . j ava 2 s .c om secondPanel.setLayout(layout); setLayout(layout); JLabel lab = new JLabel(Localization.lang("Preview") + " 1"); GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.insets = new Insets(2, 2, 2, 2); layout.setConstraints(lab, layoutConstraints); layoutConstraints.weighty = 1; layout.setConstraints(firstScrollPane, layoutConstraints); firstPanel.add(firstScrollPane); layoutConstraints.weighty = 0; layoutConstraints.gridwidth = 1; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.anchor = GridBagConstraints.WEST; layout.setConstraints(testButton, layoutConstraints); firstPanel.add(testButton); layout.setConstraints(defaultButton, layoutConstraints); firstPanel.add(defaultButton); layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; JPanel newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); firstPanel.add(newPan); lab = new JLabel(Localization.lang("Preview") + " 2"); layout.setConstraints(lab, layoutConstraints); // p2.add(lab); layoutConstraints.weighty = 1; layoutConstraints.fill = GridBagConstraints.BOTH; layout.setConstraints(secondScrollPane, layoutConstraints); secondPanel.add(secondScrollPane); layoutConstraints.weighty = 0; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.gridwidth = 1; layout.setConstraints(testButton2, layoutConstraints); secondPanel.add(testButton2); layout.setConstraints(defaultButton2, layoutConstraints); secondPanel.add(defaultButton2); layoutConstraints.gridwidth = 1; newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); secondPanel.add(newPan); layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; lab = new JLabel(Localization.lang("Preview") + " 1"); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(firstPanel, layoutConstraints); add(firstPanel); lab = new JLabel(Localization.lang("Preview") + " 2"); layoutConstraints.weighty = 0; JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); layout.setConstraints(sep, layoutConstraints); add(sep); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(secondPanel, layoutConstraints); add(secondPanel); layoutConstraints.weighty = 0; defaultButton.addActionListener(e -> { String tmp = layout1.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_0); layout1.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_0).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_0, tmp); }); defaultButton2.addActionListener(e -> { String tmp = layout2.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_1); layout2.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_1).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_1, tmp); }); testButton.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout1.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, testPanel, Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); testButton2.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout2.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, new JScrollPane(testPanel), Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); }
From source file:com.sshtools.sshterm.SshTermCommandTab.java
/** * Creates a new SshToolsConnectionCommandTab object. *//*from ww w . j a v a2 s . c o m*/ public SshTermCommandTab() { super(); JPanel main = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.insets = new Insets(0, 2, 2, 2); Insets ins2 = new Insets(2, 24, 2, 2); gbc.weightx = 1.0; requestPseudoTerminal.getModel().setSelected(false); disconnectOnSessionClose.getModel().setSelected(true); UIUtil.jGridBagAdd(main, requestPseudoTerminal, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(main, disconnectOnSessionClose, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(main, new JSeparator(JSeparator.HORIZONTAL), gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(main, onceAuthenticated, gbc, GridBagConstraints.REMAINDER); group.add(doNothing); group.add(startShell); group.add(executeCommands); startShell.setSelected(true); UIUtil.jGridBagAdd(main, doNothing, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(main, startShell, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(main, executeCommands, gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.BOTH; gbc.insets = ins2; gbc.weighty = 1.0; //commands.setLineWrap(true); commands.setBorder(BorderFactory.createEtchedBorder()); JScrollPane scroll = new JScrollPane(commands); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); UIUtil.jGridBagAdd(main, scroll, gbc, GridBagConstraints.REMAINDER); IconWrapperPanel iconProxyDetailsPanel = new IconWrapperPanel(new ResourceIcon(COMMANDS_ICON), main); commands.setRows(8); // This panel setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 1.0; add(iconProxyDetailsPanel, BorderLayout.NORTH); }