List of usage examples for java.awt Insets Insets
public Insets(int top, int left, int bottom, int right)
From source file:br.org.acessobrasil.silvinha.vista.panels.PainelSenha.java
public PainelSenha() { lblNome = new JLabel(GERAL.USUARIO); lblPass = new JLabel(GERAL.SENHA); txtName = new JTextField(10); txtPass = new JPasswordField(10); GridBagLayout bag = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); this.setLayout(bag); lblNome.setHorizontalAlignment(JLabel.RIGHT); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0;/* w ww . j a va 2 s. c o m*/ gbc.insets = new Insets(2, 10, 2, 10); this.add(lblNome, gbc); txtName.setAlignmentX(SwingConstants.WEST); txtName.addActionListener(new ActivateNextTextFieldListener(txtPass)); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(2, 0, 2, 10); this.add(txtName, gbc); lblPass.setHorizontalAlignment(JLabel.RIGHT); gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = 1; gbc.weightx = 1.0; gbc.insets = new Insets(2, 10, 2, 10); this.add(lblPass, gbc); txtPass.setAlignmentX(SwingConstants.WEST); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(2, 0, 2, 10); this.add(txtPass, gbc); setSize(300, 130); setLocation(300, 300); // this.setBackground(corDefault); op = new JOptionPane(this, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); // op.setBackground(corDefault); }
From source file:com.game.ui.views.MapEditor.java
public void generateGUI() throws IOException { setDefaultCloseOperation(DISPOSE_ON_CLOSE); // setResizable(false); JMenuBar menubar = new JMenuBar(); ImageIcon icon = null;//from www.ja v a 2 s.c o m try { icon = GameUtils.shrinkImage("save.png", 20, 20); } catch (IOException e) { System.out.println("Dialog : showDialogForMap(): Exception occured :" + e); e.printStackTrace(); } JMenu file = new JMenu("File"); JMenuItem save = new JMenuItem("Save", icon); save.setToolTipText("Save Map Information"); save.setActionCommand("Save Map"); save.addActionListener(this); file.add(save); menubar.add(file); setJMenuBar(menubar); JPanel topPanel = new JPanel(); topPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); topPanel.setLayout(new GridBagLayout()); JLabel headerLbl = new JLabel("Legend : "); headerLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); JLabel lbl1 = new JLabel(); lbl1.setPreferredSize(new Dimension(50, 20)); lbl1.setBackground(Configuration.pathColor); lbl1.setOpaque(true); JLabel lbl2 = new JLabel("- Represents the path."); JLabel lbl3 = new JLabel(); lbl3.setPreferredSize(new Dimension(50, 20)); lbl3.setBackground(Configuration.enemyColor); lbl3.setOpaque(true); JLabel lbl4 = new JLabel("- Represents the path with monsters"); JLabel lbl5 = new JLabel(); lbl5.setPreferredSize(new Dimension(50, 20)); lbl5.setBackground(Configuration.startPointColor); lbl5.setOpaque(true); JLabel lbl6 = new JLabel("- Represents the starting point in the path"); JLabel lbl7 = new JLabel(); lbl7.setBackground(Configuration.endPointColor); lbl7.setOpaque(true); lbl7.setPreferredSize(new Dimension(50, 20)); JLabel lbl8 = new JLabel("- Ending point in the path"); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.weightx = 1; c.weighty = 0; c.insets = new Insets(5, 5, 5, 5); c.gridwidth = 2; topPanel.add(headerLbl, c); c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 1; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.ipadx = 5; c.ipady = 5; topPanel.add(lbl1, c); c.gridx = 1; c.anchor = GridBagConstraints.FIRST_LINE_START; topPanel.add(lbl2, c); c.gridx = 0; c.gridy = 2; topPanel.add(lbl3, c); c.gridx = 1; topPanel.add(lbl4, c); c.gridx = 0; c.gridy = 3; topPanel.add(lbl5, c); c.gridx = 1; topPanel.add(lbl6, c); c.gridx = 0; c.gridy = 4; topPanel.add(lbl7, c); c.gridx = 1; topPanel.add(lbl8, c); add(topPanel, BorderLayout.NORTH); bottomPanel = new JPanel(); add(bottomPanel, BorderLayout.CENTER); bottomPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); // bottomPanel.add(new JButton("kaushik")); pack(); setExtendedState(JFrame.MAXIMIZED_BOTH); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); setMaximizedBounds(env.getMaximumWindowBounds()); setVisible(true); callDialogForUsersInput(); }
From source file:com.github.boogey.progressview.swing.JProgressPanel.java
/** * This protected method set the location of the components ({@link JLabel} and {@link JProgressBar}) on the * {@link JPanel}. The layout is set in the {@link #initObjects()}-method. This {@link JPanel} will use an * {@link GridBagLayout}.//from www . j a v a 2 s . c o m */ protected void positionElements() { GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets(5, 5, 5, 5); constraints.anchor = GridBagConstraints.FIRST_LINE_START; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1.0; constraints.weighty = 0.0; constraints.gridx = 0; constraints.gridy = 0; positionMessage(constraints); constraints.anchor = GridBagConstraints.FIRST_LINE_START; constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.gridy = 1; positionProgressBar(constraints); }
From source file:it.cnr.icar.eric.client.ui.swing.DiscoveryPanel.java
/** * Class Constructor./*w w w .j a v a 2s. co m*/ */ public DiscoveryPanel() throws JAXRException { GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); findParamsPanel = new FindParamsPanel(this); JPanel findResultsPanel = createFindResultsPanel(); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, findParamsPanel, findResultsPanel); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(splitPane, c); add(splitPane); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:net.daboross.outputtablesclient.gui.OutputInterface.java
public OutputInterface(final Application application) { this.application = application; // persistEnabled JSONObject parentObj = application.getPersist().getStorageObject(); JSONObject tempPersistEnabled = parentObj.optJSONObject("last-shown-panels"); if (tempPersistEnabled == null) { tempPersistEnabled = new JSONObject(); parentObj.put("last-shown-panels", tempPersistEnabled); }// w ww.j av a 2 s. c o m persistEnabled = tempPersistEnabled; // constraints toggleButtonConstraints = new GBC().ipadx(2).ipady(2).gridx(0).gridy(-1) .fill(GridBagConstraints.HORIZONTAL); tablePanelConstraints = new GBC().gridx(0).gridy(-1).weightx(1).weighty(0).anchor(GridBagConstraints.EAST) .fill(GridBagConstraints.HORIZONTAL); // mainTabPanel mainTabPanel = new JPanel(); mainTabPanel.setLayout(new GridBagLayout()); application.getRoot().getMainPanel().add(mainTabPanel, new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(0).gridy(1)); // toggleButtonPanel toggleButtonPanel = new JPanel(); toggleButtonPanel.setLayout(new GridBagLayout()); mainTabPanel.add(toggleButtonPanel, new GBC().weightx(0).weighty(0).gridx(0).gridy(0) .insets(new Insets(0, 0, 10, 10)).anchor(GridBagConstraints.NORTHWEST)); // tableRootPanel tableRootPanel = new JPanel(new GridBagLayout()); mainTabPanel.add(tableRootPanel, new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(2) .gridy(0).anchor(GridBagConstraints.EAST)); // maps tableKeyToTableButton = new TreeMap<>(); tableKeyToTableEnabled = new TreeMap<>(); tableKeyToTablePanel = new HashMap<>(); tableKeyAndKeyToValuePanel = new HashMap<>(); tableKeyAndKeyToValueLabel = new HashMap<>(); tableKeyToTableTitledBoarder = new HashMap<>(); }
From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java
private JPanel createTopPanel() { refreshButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ViewRefresh22.png"), false); refreshButton.setToolTipText("Refresh View"); refreshButton.setName("refreshButton"); refreshButton.addActionListener(e -> { updateChartData();/*w w w .j a v a 2 s .c o m*/ refreshButton.setEnabled(false); }); AbstractButton switchToTableButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Table24.png"), false); switchToTableButton.setToolTipText("Switch to Table View"); switchToTableButton.setName("switchToTableButton"); switchToTableButton.setEnabled(hasAlternativeView()); switchToTableButton.addActionListener(e -> showAlternativeView()); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(2, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(2, 1.0); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); JPanel buttonPanel = new JPanel(tableLayout); buttonPanel.add(refreshButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(switchToTableButton); buttonPanel.add(new JPanel()); return buttonPanel; }
From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyResetComment.java
private void initialize() { GridBagConstraints gridBagConstraintsPanelComment = new GridBagConstraints(); gridBagConstraintsPanelComment.fill = GridBagConstraints.BOTH; gridBagConstraintsPanelComment.gridx = 0; gridBagConstraintsPanelComment.gridy = 0; gridBagConstraintsPanelComment.weightx = 1.0; gridBagConstraintsPanelComment.weighty = 1.0; GridBagConstraints gridBagConstraintsOKResetBtn = new GridBagConstraints(); gridBagConstraintsOKResetBtn.anchor = GridBagConstraints.NORTHWEST; gridBagConstraintsOKResetBtn.insets = new Insets(10, 10, 0, 10); gridBagConstraintsOKResetBtn.gridx = 1; gridBagConstraintsOKResetBtn.gridy = 0; this.setLayout(new GridBagLayout()); this.add(getJScrollPaneComment(), gridBagConstraintsPanelComment); this.add(getJPanelOkResetBtn(), gridBagConstraintsOKResetBtn); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java
/** * This method initializes this/*from ww w . j ava 2s. c o m*/ * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 2; 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.weighty = 1.0; gridBagConstraints7.anchor = GridBagConstraints.CENTER; gridBagConstraints7.gridy = 0; this.setLayout(new GridBagLayout()); this.add(getJPanelValue(), gridBagConstraints7); this.add(getJPanelButtons(), gridBagConstraints9); }
From source file:com.igormaznitsa.sciareto.ui.tabs.TabTitle.java
public TabTitle(@Nonnull final Context context, @Nonnull final TabProvider parent, @Nullable final File associatedFile) { super(new GridBagLayout()); this.parent = parent; this.context = context; this.associatedFile = associatedFile; this.changed = this.associatedFile == null; this.setOpaque(false); final GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1000.0d;//from w ww .j ava 2 s .com final TabTitle theInstance = this; this.titleLabel = new JLabel() { private static final long serialVersionUID = 8689945842487138781L; @Override protected void processKeyEvent(@Nonnull final KeyEvent e) { theInstance.getParent().dispatchEvent(e); } @Override public String getToolTipText() { return theInstance.getToolTipText(); } @Override public boolean isFocusable() { return false; } }; this.add(this.titleLabel, constraints); final Icon uiCloseIcon = UIManager.getIcon("InternalFrameTitlePane.closeIcon"); this.closeButton = new JButton(uiCloseIcon == null ? NIMBUS_CLOSE_ICON : uiCloseIcon) { private static final long serialVersionUID = -8005282815756047979L; @Override public String getToolTipText() { return theInstance.getToolTipText(); } @Override public boolean isFocusable() { return false; } }; this.closeButton.setToolTipText("Close tab"); this.closeButton.setBorder(null); this.closeButton.setContentAreaFilled(false); this.closeButton.setMargin(new Insets(0, 0, 0, 0)); this.closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.closeButton.setOpaque(false); this.closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(@Nonnull final ActionEvent e) { doSafeClose(); } }); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 0.0d; constraints.insets = new Insets(2, 8, 2, 0); this.add(this.closeButton, constraints); updateView(); ToolTipManager.sharedInstance().registerComponent(closeButton); ToolTipManager.sharedInstance().registerComponent(this.titleLabel); ToolTipManager.sharedInstance().registerComponent(this); }
From source file:interpolation.InterpolantFileChooser.java
public InterpolantFileChooser() { final JFrame frame = new JFrame("Welcome to the Regression fits"); Track = new JButton("Choose file"); panelCont.add(panelIntro, "1"); /* Instantiation */ final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints c = new GridBagConstraints(); panelIntro.setLayout(layout);/*ww w . j a v a2 s.c o m*/ final Label LoadtrackText = new Label("Input the .txt file of time-series"); LoadtrackText.setBackground(new Color(1, 0, 1)); LoadtrackText.setForeground(new Color(255, 255, 255)); final Checkbox Simplemode = new Checkbox("Open simple time-series file", Simplefile); /* Location */ c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1.5; ++c.gridy; c.insets = new Insets(10, 10, 10, 0); panelIntro.add(LoadtrackText, c); ++c.gridy; c.insets = new Insets(10, 10, 10, 0); panelIntro.add(Track, c); panelIntro.setVisible(true); Track.addActionListener(new OpenTrackListener(frame)); Simplemode.addItemListener(new SimpleListener(frame)); frame.addWindowListener(new FrameListener(frame)); frame.add(panelCont, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); }