Java Code Examples for java.awt.GridBagConstraints#SOUTH
The following examples show how to use
java.awt.GridBagConstraints#SOUTH .
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: BoxTabbedPaneUI.java From pumpernickel with MIT License | 6 votes |
protected GridBagConstraints createCloseButtonConstraints() { GridBagConstraints closeButtonConstraints = new GridBagConstraints(); closeButtonConstraints.gridx = 0; closeButtonConstraints.gridy = 0; closeButtonConstraints.weightx = 1; closeButtonConstraints.weighty = 1; closeButtonConstraints.fill = GridBagConstraints.NONE; if (tabs.getTabPlacement() == SwingConstants.LEFT) { closeButtonConstraints.anchor = GridBagConstraints.SOUTH; } else if (tabs.getTabPlacement() == SwingConstants.RIGHT) { closeButtonConstraints.anchor = GridBagConstraints.NORTH; } else { closeButtonConstraints.anchor = GridBagConstraints.WEST; } if (tabs.getTabPlacement() == SwingConstants.LEFT) { closeButtonConstraints.insets = new Insets(0, 0, 3, 0); } else if (tabs.getTabPlacement() == SwingConstants.RIGHT) { closeButtonConstraints.insets = new Insets(3, 0, 0, 0); } else { closeButtonConstraints.insets = new Insets(0, 3, 0, 0); } return closeButtonConstraints; }
Example 2
Source File: HistoryWindow.java From Spark with Apache License 2.0 | 5 votes |
private Component getMessagesPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.weightx = 1; c.weighty = 1; panel.add(historyContentTextScrollPane, c); c.anchor = GridBagConstraints.SOUTH; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.weightx = 1; c.weighty = 0.02; c.insets = new Insets(0, 0, 0, 3); panel.add(findTextField, c); c.gridx = 1; c.gridy = 1; c.gridwidth = 1; c.weightx = 0.1; c.insets = new Insets(0, 0, 0, 0); panel.add(btnFind, c); return panel; }
Example 3
Source File: Palette.java From WorldPainter with GNU General Public License v3.0 | 5 votes |
Palette(String name, List<Component> buttonComponents) { super(); this.name = name; panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets(1, 1, 1, 1); JideLabel label = new JideLabel("Show"); label.setOrientation(SwingConstants.VERTICAL); label.setClockwise(false); label.setMinimumSize(label.getPreferredSize()); constraints.anchor = GridBagConstraints.SOUTH; panel.add(label, constraints); label = new JideLabel("Solo"); label.setOrientation(SwingConstants.VERTICAL); label.setClockwise(false); label.setMinimumSize(label.getPreferredSize()); panel.add(label, constraints); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.weightx = 1.0; panel.add(new JLabel(), constraints); constraints.anchor = GridBagConstraints.FIRST_LINE_START; constraints.weightx = 0.0; LayoutUtils.addRowOfComponents(panel, constraints, buttonComponents); dockableFrame = new App.DockableFrameBuilder(panel, name, DockContext.DOCK_SIDE_WEST, 3).build(); dockableFrame.setKey("customLayerPalette." + name); }
Example 4
Source File: TableLayout.java From EchoSim with Apache License 2.0 | 4 votes |
private void parseSetting(GridBagConstraints gbc, String key, String val) { int v; try { v = Integer.parseInt(val); } catch (NumberFormatException e) { v = 0; } if (key.equals("x") || key.equals("gridx")) { if (val.equals(".")) gbc.gridx = currentX; else if (val.equals("+")) gbc.gridx = ++currentX; else gbc.gridx = v; } else if (key.equals("y") || key.equals("gridy")) { if (val.equals(".")) gbc.gridy = currentY; else if (val.equals("+")) gbc.gridy = ++currentY; else gbc.gridy = v; } else if (key.equals("gridwidth") || key.equals("width")) gbc.gridwidth = v; else if (key.equals("gridheight") || key.equals("height")) gbc.gridheight = v; else if (key.equals("weightx")) gbc.weightx = v; else if (key.equals("weighty")) gbc.weighty = v; else if (key.equals("ipadx")) gbc.ipadx = v; else if (key.equals("ipady")) gbc.ipady = v; else if (key.equals("fill")) { if (val.equals("none")) gbc.fill = GridBagConstraints.NONE; else if (val.equals("horizontal") || val.equals("h")) gbc.fill = GridBagConstraints.HORIZONTAL; else if (val.equals("vertical") || val.equals("v")) gbc.fill = GridBagConstraints.VERTICAL; else if (val.equals("both") || val.equals("hv")) gbc.fill = GridBagConstraints.BOTH; } else if (key.equals("anchor")) { if (val.equals("center")) gbc.anchor = GridBagConstraints.CENTER; else if (val.equals("north") || val.equals("n")) gbc.anchor = GridBagConstraints.NORTH; else if (val.equals("northeast") || val.equals("ne")) gbc.anchor = GridBagConstraints.NORTHEAST; else if (val.equals("east") || val.equals("e")) gbc.anchor = GridBagConstraints.EAST; else if (val.equals("southeast") || val.equals("se")) gbc.anchor = GridBagConstraints.SOUTHEAST; else if (val.equals("south") || val.equals("s")) gbc.anchor = GridBagConstraints.SOUTH; else if (val.equals("southwest") || val.equals("sw")) gbc.anchor = GridBagConstraints.SOUTHWEST; else if (val.equals("west") || val.equals("w")) gbc.anchor = GridBagConstraints.WEST; else if (val.equals("northwest") || val.equals("nw")) gbc.anchor = GridBagConstraints.NORTHWEST; } }
Example 5
Source File: ControlWindow.java From ChatGameFontificator with The Unlicense | 4 votes |
private void setupHelp() { final String helpTitle = "Chat Game Fontificator Help"; help = new JDialog(this, true); help.setTitle(helpTitle); help.setSize(640, 480); help.setLayout(new GridBagLayout()); JEditorPane helpPane = new JEditorPane(); helpPane.setContentType("text/html"); helpPane.setText(helpText); helpPane.setEditable(false); JScrollPane scrollHelp = new JScrollPane(helpPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JButton ok = new JButton("Close"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { help.setVisible(false); } }); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTH; help.add(new JLabel("The function of each option available in the Control Window tabs is explained below"), gbc); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.CENTER; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.gridy = 1; help.add(scrollHelp, gbc); gbc.gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.SOUTH; gbc.weighty = 0.0; help.add(ok, gbc); help.setResizable(false); }
Example 6
Source File: SplashScreen.java From importer-exporter with Apache License 2.0 | 4 votes |
private void init(int numberOfSteps, int messageX, int messageY, Color messageColor) { JPanel content = new JPanel() { public boolean isOptimizedDrawingEnabled() { return false; } }; content.setLayout(new OverlayLayout(content)); content.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1)); JPanel dynamicContent = new JPanel(); dynamicContent.setOpaque(false); dynamicContent.setLayout(new GridBagLayout()); message = new JLabel(); message.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12)); message.setForeground(messageColor); progressBar = new JProgressBar(); progressBar.setPreferredSize(new Dimension(icon.getIconWidth(), 18)); progressBar.setIndeterminate(false); progressBar.setMaximum(numberOfSteps); progressBar.setVisible(false); GridBagConstraints c = GuiUtil.setConstraints(0, 0, 1, 1, GridBagConstraints.HORIZONTAL, 5 + messageY, 5 + messageX, 0, 5); c.anchor = GridBagConstraints.NORTH; dynamicContent.add(message, c); c = GuiUtil.setConstraints(0, 1, 1, 1, GridBagConstraints.HORIZONTAL, 5, 5, 5, 5); c.anchor = GridBagConstraints.SOUTH; dynamicContent.add(progressBar, c); dynamicContent.setAlignmentX(0f); dynamicContent.setAlignmentY(0f); content.add(dynamicContent); JLabel image = new JLabel(icon); image.setAlignmentX(0f); image.setAlignmentY(0f); content.add(image); add(content, BorderLayout.CENTER); // center on screen Toolkit t = Toolkit.getDefaultToolkit(); Insets frame_insets = t.getScreenInsets(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()); int frame_insets_x = frame_insets.left + frame_insets.right; int frame_insets_y = frame_insets.bottom + frame_insets.top; Dimension dim = t.getScreenSize(); int x = (dim.width - icon.getIconWidth() - frame_insets_x) / 2; int y = (dim.height - icon.getIconHeight() - frame_insets_y) / 2; setMinimumSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); setLocation(x, y); setAlwaysOnTop(true); }
Example 7
Source File: GraphPanel.java From chipster with MIT License | 4 votes |
/** * Creates a new GraphPanel with default contents and appearance. */ public GraphPanel() { getGraph().getSelectionModel().addGraphSelectionListener(new WorkflowSelectionListener()); getGraph().setMarqueeHandler(new BasicMarqueeHandler()); // getGraph().setDebugGraphicsOptions(DebugGraphics.LOG_OPTION); // getGraph().setDoubleBuffered(false); this.setMinimumSize(new Dimension(0, 0)); this.setLayout(new GridBagLayout()); buttonToolBar = this.getButtonToolBar(); graphScroller = this.getGraphScroller(); this.setPreferredSize(new Dimension(VisualConstants.LEFT_PANEL_WIDTH, VisualConstants.GRAPH_PANEL_HEIGHT)); graphScroller.setPreferredSize(new Dimension(VisualConstants.LEFT_PANEL_WIDTH, VisualConstants.GRAPH_PANEL_HEIGHT)); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.SOUTH; c.gridy = 1; this.add(buttonToolBar, c); c.gridx = 0; c.gridy = 2; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTH; c.weightx = 1.0; c.weighty = 1.0; this.add(graphScroller, c); // start listening application.addClientEventListener(this); application.getDataManager().addDataChangeListener(this); graph.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); graph.setScale(graph.getScale() / ZOOM_FACTOR); // adds vertex renderer which adds the small '+' and '-' buttons to group VertexView.renderer = new GraphRenderer(); }