List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java
/** * This method initializes this/*from www.j av a2 s . com*/ * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints41 = new GridBagConstraints(); gridBagConstraints41.gridx = 0; gridBagConstraints41.gridwidth = 2; gridBagConstraints41.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints41.weighty = 0.01; gridBagConstraints41.weightx = 1.0; gridBagConstraints41.gridy = 1; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 0; gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints3.gridwidth = 2; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.insets = new Insets(0, 20, 0, 0); gridBagConstraints3.gridy = 3; jLabelLicense = new JLabel(); jLabelLicense.setText("License :"); jLabelLicense.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelComponent = new JLabel(); jLabelComponent.setText("Component :"); jLabelComponent.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelBinding = new JLabel(); jLabelBinding.setText("Binding Type :"); jLabelBinding.setFont(new Font("Dialog", Font.PLAIN, 12)); this.setLayout(new GridBagLayout()); this.setSize(570, 480); this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); this.setLocation(new Point(0, 0)); this.add(getJScrollPaneFolder(), gridBagConstraints3); this.add(getJScrollPanePanel(), gridBagConstraints41); getJRadioButtonNotContain().setSelected(false); getJRadioButtonThird().setSelected(false); getJRadioButtonIKnow().setSelected(true); getJScrollPaneFolder().setVisible(true); }
From source file:captureplugin.drivers.DeviceCreatorDialog.java
/** * Create the GUI/*from www .j a va 2 s. c o m*/ */ private void createGUI() { UiUtilities.registerForClosing(this); DriverIf[] drivers = DriverFactory.getInstance().getDrivers(); mDriverCombo = new JComboBox(drivers); mDriverCombo.setRenderer(new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof DriverIf) { value = ((DriverIf) value).getDriverName(); } return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); } }); JPanel panel = (JPanel) getContentPane(); panel.setLayout(new GridBagLayout()); GridBagConstraints label = new GridBagConstraints(); label.insets = new Insets(5, 5, 5, 5); label.anchor = GridBagConstraints.NORTHWEST; GridBagConstraints input = new GridBagConstraints(); input.fill = GridBagConstraints.HORIZONTAL; input.weightx = 1.0; input.gridwidth = GridBagConstraints.REMAINDER; input.insets = new Insets(5, 5, 5, 5); panel.add(new JLabel(mLocalizer.msg("Name", "Name")), label); mName = new JTextField(); panel.add(mName, input); panel.add(new JLabel(mLocalizer.msg("Driver", "Driver")), label); panel.add(mDriverCombo, input); mDesc = UiUtilities.createHtmlHelpTextArea(""); mDesc.setEditable(false); panel.add(new JLabel(mLocalizer.msg("Description", "Description")), input); GridBagConstraints descC = new GridBagConstraints(); descC.weightx = 1.0; descC.weighty = 1.0; descC.fill = GridBagConstraints.BOTH; descC.gridwidth = GridBagConstraints.REMAINDER; descC.insets = new Insets(5, 5, 5, 5); panel.add(new JScrollPane(mDesc, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), descC); final Font font = new JLabel().getFont(); String desc = ((DriverIf) mDriverCombo.getSelectedItem()).getDriverDesc(); desc = "<html><div style=\"color:#000000;font-family:" + font.getName() + "; font-size:" + font.getSize() + ";\">" + desc + "</div></html>"; mDesc.setText(desc); mDesc.setFont(font); mDriverCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { String description = ((DriverIf) mDriverCombo.getSelectedItem()).getDriverDesc(); description = "<html><div style=\"color:#000000;font-family:" + font.getName() + "; font-size:" + font.getSize() + ";\">" + description + "</div></html>"; mDesc.setText(description); mDesc.setFont(font); } }); final JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK)); ok.setEnabled(false); final JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL)); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okPressed(); } }); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); } }); mName.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { updateButtons(); } @Override public void insertUpdate(DocumentEvent e) { updateButtons(); } @Override public void changedUpdate(DocumentEvent e) { updateButtons(); } private void updateButtons() { ok.setEnabled(!mName.getText().trim().isEmpty()); } }); ButtonBarBuilder2 builder = new ButtonBarBuilder2(); builder.addGlue(); builder.addButton(new JButton[] { ok, cancel }); getRootPane().setDefaultButton(ok); input.insets = new Insets(5, 5, 5, 5); panel.add(builder.getPanel(), input); setSize(400, 300); }
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 . jav a 2 s .c om 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:fr.free.hd.servers.gui.FaceView.java
@Override protected JComponent createControl() { final GridBagLayout layout = new GridBagLayout(); final JPanel view = new JPanel(layout); //Face list//from w ww . j ava2 s .c om GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.gridheight = 3; c.weighty = 0.75; c.weightx = 0.15; c.fill = GridBagConstraints.BOTH; final JList facesList = CreateList(); facesList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { if (facesList.getSelectedIndex() != -1) { face = (Face) facesList.getSelectedValue(); updateLabel(); } else { } } } }); view.add(facesList, c); // New button c = new GridBagConstraints(); c.gridx = 0; c.gridy = 3; c.fill = GridBagConstraints.BOTH; JButton btnNew = new JButton("Nouveau"); btnNew.setEnabled(false); view.add(btnNew, c); // Save button c = new GridBagConstraints(); c.gridx = 0; c.gridy = 4; c.fill = GridBagConstraints.BOTH; JButton btnModified = new JButton("Modifier"); btnModified.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { facesDAO.storeFace(face); } }); view.add(btnModified, c); //Draw Face c = new GridBagConstraints(); c.gridx = 1; c.gridy = 0; c.gridheight = 5; c.gridwidth = 1; c.fill = GridBagConstraints.BOTH; c.weightx = 0.60; lblFace = new JLabel(); view.add(lblFace, c); //Hand Panel c = new GridBagConstraints(); c.gridx = 2; c.gridy = 0; c.weightx = 0.15; c.fill = GridBagConstraints.BOTH; JPanel pnlHand = createPosition(); view.add(pnlHand, c); //Mouth Panel c = new GridBagConstraints(); c.gridx = 2; c.gridy = 1; c.weightx = 0.15; c.fill = GridBagConstraints.BOTH; JPanel pnlKind = createKind(); view.add(pnlKind, c); //Mouth Panel c = new GridBagConstraints(); c.gridx = 2; c.gridy = 2; c.weightx = 0.15; c.fill = GridBagConstraints.BOTH; JPanel pnlMouth = createMouth(); view.add(pnlMouth, c); // Picture filename c = new GridBagConstraints(); c.gridx = 0; c.gridy = 5; c.gridwidth = 2; c.fill = GridBagConstraints.BOTH; JTextField txtPath = new JTextField(); view.add(txtPath, c); //Browse Button c = new GridBagConstraints(); c.gridx = 2; c.gridy = 5; c.fill = GridBagConstraints.BOTH; JButton btnBrownse = new JButton("Browse"); view.add(btnBrownse, c); //Select default face if (facesList.getModel().getSize() > 0) { facesList.setSelectedIndex(0); position = HandPositionEnum.HAND_POSITION_MENTON; kind = HandKeyEnum.HAND_KEY_2V; } return view; }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java
/** * This method initializes this//from ww w . j a va 2 s . 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:algorithm.MetsSubmissionInformationPackage.java
private void createConfigurationPanel() { panel = new GUIPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0;/*from w w w.j a v a 2 s .co m*/ constraints.gridy = 0; constraints.anchor = GridBagConstraints.NORTHWEST; panel.add(new JLabel("<html><h2>Add information to mets file</h2></html>"), constraints); constraints.gridy++; panel.add(new JLabel("Add person: "), constraints); constraints.gridx++; ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(truePersonButton); panel.add(truePersonButton, constraints); constraints.gridx++; buttonGroup.add(falsePersonButton); falsePersonButton.setSelected(true); panel.add(falsePersonButton, constraints); constraints.gridy++; constraints.gridx = 0; panel.add(new JLabel("Name:"), constraints); constraints.gridx++; constraints.gridwidth = 2; panel.add(personField, constraints); constraints.gridwidth = 1; constraints.gridx = 0; constraints.gridy++; panel.add(new JLabel("Choose archiving technique:"), constraints); constraints.gridx++; ButtonGroup archivingGroup = new ButtonGroup(); archivingGroup.add(tarButton); archivingGroup.add(zipButton); zipButton.setSelected(true); panel.add(zipButton, constraints); constraints.gridy++; panel.add(tarButton, constraints); constraints.gridx = 0; constraints.gridy++; }
From source file:client.gui.ButtonPanel.java
public ButtonPanel() { GlobalVariables.buttonPanel = this; exchangeCards = new JButton("Exchange cards"); exchangeCards.setHorizontalAlignment(SwingConstants.LEFT); exchangeCards.addActionListener(this); check = new JButton("Check"); check.setHorizontalAlignment(SwingConstants.LEFT); check.addActionListener(this); bet = new JButton("Bet"); bet.setHorizontalAlignment(SwingConstants.LEFT); bet.addActionListener(this); raise = new JButton("Raise"); raise.setHorizontalAlignment(SwingConstants.LEFT); raise.addActionListener(this); call = new JButton("Call"); call.setHorizontalAlignment(SwingConstants.LEFT); call.addActionListener(this); fold = new JButton("Fold"); fold.setHorizontalAlignment(SwingConstants.LEFT); fold.addActionListener(this); allIn = new JButton("All-In"); allIn.setHorizontalAlignment(SwingConstants.LEFT); allIn.addActionListener(this); startGame = new JButton("Start Game"); startGame.setHorizontalAlignment(SwingConstants.LEFT); startGame.addActionListener(this); smallBlind = new JButton("Small Blind"); smallBlind.setHorizontalAlignment(SwingConstants.LEFT); smallBlind.addActionListener(this); bigBlind = new JButton("Big Blind"); bigBlind.setHorizontalAlignment(SwingConstants.LEFT); bigBlind.addActionListener(this); liveBlind = new JButton("Live Blind"); liveBlind.setHorizontalAlignment(SwingConstants.LEFT); liveBlind.addActionListener(this); setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5;/* w w w . ja va 2s. com*/ c.gridx = 0; c.gridy = 0; add(exchangeCards, c); c.gridy++; add(check, c); c.gridy++; add(bet, c); c.gridy++; add(raise, c); c.gridy++; add(call, c); c.gridy++; add(fold, c); c.gridy++; add(allIn, c); // c.gridy++; // add(startGame, c); c.gridy++; add(smallBlind, c); c.gridy++; add(bigBlind, c); c.gridy++; add(liveBlind, c); exchangeCards.setVisible(false); check.setVisible(false); bet.setVisible(false); raise.setVisible(false); call.setVisible(false); fold.setVisible(false); allIn.setVisible(false); smallBlind.setVisible(false); bigBlind.setVisible(false); liveBlind.setVisible(false); }
From source file:be.tutul.naheulcraft.launcher.auth.LogInForm.java
private void createUserDropdownPanel(Font labelFont) { this.userDropdownPanel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = 2;//from www. j av a 2 s.c o m constraints.gridx = 0; constraints.gridy = -1; constraints.weightx = 1.0D; this.userDropdownPanel.add(Box.createVerticalStrut(8), constraints); JLabel userDropdownLabel = new JLabel("Pseudo : "); userDropdownLabel.setFont(labelFont); this.userDropdownPanel.add(userDropdownLabel, constraints); this.userDropdownPanel.add(this.userDropdown, constraints); this.userDropdownPanel.setVisible(false); }
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 w w w. j ava 2s .com*/ */ 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:com.jostrobin.battleships.view.frames.GameFrame.java
public void addChatPanel(int gridX, int gridY) { GridBagConstraints chatPanelConstraints = new GridBagConstraints(); chatPanelConstraints.gridy = gridY;/*ww w .j av a 2 s.co m*/ chatPanelConstraints.gridx = gridX; chatPanelConstraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; chatPanelConstraints.fill = GridBagConstraints.BOTH; chatPanelConstraints.weightx = 1.0; chatPanelConstraints.weighty = 0.2; add(chatPanel, chatPanelConstraints); }