List of usage examples for java.awt GridBagConstraints NORTH
int NORTH
To view the source code for java.awt GridBagConstraints NORTH.
Click Source Link
From source file:cc.pinel.mangue.ui.ChaptersPanel.java
/** * @param main the main controller//from w w w . j a v a 2s. c o m * @param manga the manga */ public ChaptersPanel(Main main, Manga manga) { super(new GridBagLayout()); this.main = main; chaptersPages = new KPages(PageProviders.createKBoxLayoutProvider(KBoxLayout.Y_AXIS)); chaptersPages.setFocusable(true); chaptersPages.setEnabled(true); chaptersPages.setPageKeyPolicy(KPages.PAGE_KEYS_LOCAL); chapterListener = new ChapterLabelActionListener(); GridBagConstraints gc = new GridBagConstraints(); gc.gridx = 0; gc.gridy = 0; gc.insets = new Insets(20, 20, 20, 20); gc.anchor = GridBagConstraints.NORTH; gc.weightx = 1.0; gc.weighty = 1.0; gc.fill = GridBagConstraints.BOTH; add(chaptersPages, gc); chaptersPages.first(); loadChapters(manga); }
From source file:net.sourceforge.pmd.util.designer.CreateXMLRulePanel.java
public CreateXMLRulePanel(JTextArea xpathQueryArea, CodeEditorTextPane codeEditorPane) { super();//from w ww .j a v a 2s .com this.xpathQueryArea = xpathQueryArea; this.codeEditorPane = codeEditorPane; GridBagConstraints gbc = new GridBagConstraints(); // We use a gridbaglayout for a nice and sturdy look and feel GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 0.5; JLabel rulenameLabel = new JLabel("Rule name : "); gbl.setConstraints(rulenameLabel, gbc); add(rulenameLabel); gbc.weightx = 0.5; gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 1; gbl.setConstraints(rulenameField, gbc); add(rulenameField); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 0.5; JLabel rulemsgLabel = new JLabel("Rule msg : "); gbl.setConstraints(rulemsgLabel, gbc); add(rulemsgLabel); gbc.gridx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.weightx = 0.5; gbl.setConstraints(rulemsgField, gbc); add(rulemsgField); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 0.5; JLabel ruledescLabel = new JLabel("Rule desc : "); gbl.setConstraints(ruledescLabel, gbc); add(ruledescLabel); gbc.gridx = 1; gbc.anchor = GridBagConstraints.WEST; gbc.weightx = 0.5; ruledescField.setLineWrap(true); gbl.setConstraints(ruledescField, gbc); add(ruledescField); gbc.gridx = 0; gbc.gridy = 3; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.NORTH; JButton createRuleBtn = new JButton("Create rule XML"); createRuleBtn.addActionListener(this); gbl.setConstraints(createRuleBtn, gbc); add(createRuleBtn); gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; JScrollPane ruleXMLPane = new JScrollPane(ruleXMLArea); gbl.setConstraints(ruleXMLPane, gbc); add(ruleXMLPane); repaint(); }
From source file:com.github.pemapmodder.pocketminegui.gui.server.ConsolePanel.java
public ConsolePanel(ServerMainActivity activity) { this.activity = activity; setLayout(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(20, 10, 20, 10)); title = new JLabel("PocketMine-MP"); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.HORIZONTAL; c.weighty = 0.1;//from ww w .java2 s. c o m add(title, c); stdout = new JEditorPane(); stdout.setContentType("text/html"); stdout.setText("<html><body style='font-family: monospace; color: #FFFFFF;'><p id='p'></p></body></html>"); doc = (HTMLDocument) stdout.getDocument(); para = doc.getElement("p"); // stdout.setEditable(false); // People NEED to see this to feel happy stdout.setForeground(Color.WHITE); stdout.setBackground(Color.BLACK); Style style = doc.getStyleSheet().addStyle(null, null); // style.addAttribute(StyleConstants.Foreground, Color.WHITE); // style.addAttribute(StyleConstants.Background, Color.RED); doc.setParagraphAttributes(para.getStartOffset(), 1, style, true); stdout.setBorder(BorderFactory.createDashedBorder(new Color(0x80, 0x80, 0x80))); c.gridy = 1; c.weightx = 0.9; c.weighty = 0.9; c.weighty = 0.6; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTH; add(stdout, c); Timer timer = new Timer(50, e -> updateConsole()); timer.start(); }
From source file:org.executequery.gui.scriptgenerators.GenerateScriptsPanelThree.java
private void init() throws Exception { openInQueryEditor = new JCheckBox("View in a new Query Editor", true); gbc = new GridBagConstraints(); gbc.gridx++;//from w w w. j ava 2 s.c o m gbc.gridy++; gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets.top = 10; gbc.insets.left = 10; add(openInQueryEditor, gbc); gbc.gridy++; gbc.insets.left = 0; add(createFileOutputPanel(), gbc); gbc.gridy++; gbc.insets.top = 10; gbc.insets.bottom = 0; gbc.weighty = 1.0; gbc.weightx = 1.0; if (parent.getScriptType() == GenerateScriptsWizard.CREATE_TABLES) { createTableOptionsPanel(); add(createTableOptionsPanel, gbc); } else { createUseCascadeCheck(); useCascadeCheck.setBorder(BorderFactory.createEmptyBorder(0, 13, 0, 0)); add(useCascadeCheck, gbc); } }
From source file:com.sshtools.sshterm.SshTermCommandTab.java
/** * Creates a new SshToolsConnectionCommandTab object. *//*from ww w .ja va2 s . co 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); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java
private void initialize() { GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 2;// w w w .jav a 2 s . 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.digitalgeneralists.assurance.ui.components.FileAttributesPanel.java
private void initializeComponent() { if (!this.initialized) { if (this.file == null) { this.dialogTitle = "No File Provided"; this.file = null; } else {/* w ww.j ava 2s .com*/ StringBuilder title = new StringBuilder(128); this.dialogTitle = title.append("Attributes for ").append(file.getFile().getName()).toString(); title.setLength(0); title = null; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); GridBagConstraints filePanelConstraints = new GridBagConstraints(); filePanelConstraints.anchor = GridBagConstraints.NORTH; filePanelConstraints.fill = GridBagConstraints.HORIZONTAL; filePanelConstraints.gridx = 0; filePanelConstraints.gridy = 0; filePanelConstraints.weightx = 1.0; filePanelConstraints.weighty = 0.1; filePanelConstraints.gridheight = 1; filePanelConstraints.gridwidth = 1; filePanelConstraints.insets = new Insets(5, 5, 5, 5); final JPanel filePanel = new JPanel(); filePanel.setLayout(new GridBagLayout()); GridBagConstraints filePathValueConstraints = new GridBagConstraints(); filePathValueConstraints.anchor = GridBagConstraints.WEST; filePathValueConstraints.gridx = 0; filePathValueConstraints.gridy = 0; filePathValueConstraints.weightx = 1.0; filePathValueConstraints.weighty = 1.0; filePathValueConstraints.gridheight = 1; filePathValueConstraints.gridwidth = 1; filePathValueConstraints.insets = new Insets(5, 5, 5, 5); String filePath = "File is null."; if (file != null) { File diskFile = file.getFile(); if (diskFile == null) { filePath = "The disk file is not set."; } else { filePath = diskFile.getPath(); } diskFile = null; } JLabel filePathValue = new JLabel(filePath); filePath = null; filePanel.add(filePathValue, filePathValueConstraints); this.add(filePanel, filePanelConstraints); Border attributesBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); attributesBorder = BorderFactory.createTitledBorder(attributesBorder, "File Attributes", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints attributesPanelConstraints = new GridBagConstraints(); attributesPanelConstraints.anchor = GridBagConstraints.SOUTH; attributesPanelConstraints.fill = GridBagConstraints.BOTH; attributesPanelConstraints.gridx = 0; attributesPanelConstraints.gridy = 1; attributesPanelConstraints.weightx = 1.0; attributesPanelConstraints.weighty = 0.9; attributesPanelConstraints.gridheight = 1; attributesPanelConstraints.gridwidth = 1; attributesPanelConstraints.insets = new Insets(0, 5, 5, 5); JPanel attributesPanel = this.createFileAttributesPanel(file); attributesPanel.setBorder(attributesBorder); this.add(attributesPanel, attributesPanelConstraints); this.initialized = true; } }
From source file:com.digitalgeneralists.assurance.ui.components.ExclusionsPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.exclusion == null) { this.mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Exclusion"; this.exclusion = new FileReference(); } else {/*from ww w. j a v a 2s . c o m*/ this.mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Exclusion"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel exclusionPathPanel = new JPanel(); exclusionPathPanel.setLayout(new GridBagLayout()); Border exclusionPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); exclusionPanelBorder = BorderFactory.createTitledBorder(exclusionPanelBorder, "Exclusion", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints exclusionPathPanelConstraints = new GridBagConstraints(); exclusionPathPanelConstraints.anchor = GridBagConstraints.NORTH; exclusionPathPanelConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathPanelConstraints.gridx = 0; exclusionPathPanelConstraints.gridy = 0; exclusionPathPanelConstraints.weightx = 1.0; exclusionPathPanelConstraints.weighty = 1.0; exclusionPathPanelConstraints.gridheight = 1; exclusionPathPanelConstraints.gridwidth = 2; exclusionPathPanelConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.setBorder(exclusionPanelBorder); this.add(exclusionPathPanel, exclusionPathPanelConstraints); GridBagConstraints exclusionPathFieldConstraints = new GridBagConstraints(); exclusionPathFieldConstraints.anchor = GridBagConstraints.NORTH; exclusionPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL; exclusionPathFieldConstraints.gridx = 0; exclusionPathFieldConstraints.gridy = 1; exclusionPathFieldConstraints.weightx = 1.0; exclusionPathFieldConstraints.weighty = 1.0; exclusionPathFieldConstraints.gridheight = 1; exclusionPathFieldConstraints.gridwidth = 1; exclusionPathFieldConstraints.insets = new Insets(5, 5, 5, 5); exclusionPathPanel.add(this.exclusionPathTextFieldPicker, exclusionPathFieldConstraints); if (this.exclusion != null) { File exclusionPath = exclusion.getFile(); if (exclusionPath != null) { this.exclusionPathTextFieldPicker.setValue(exclusionPath.getPath()); } else { this.exclusionPathTextFieldPicker.setValue(""); } } this.initialized = true; } }
From source file:MultipartViewer.java
protected void setupDisplay(Multipart mp) { // we display the first body part in a main frame on the left, and then // on the right we display the rest of the parts as attachments GridBagConstraints gc = new GridBagConstraints(); gc.gridheight = GridBagConstraints.REMAINDER; gc.fill = GridBagConstraints.BOTH; gc.weightx = 1.0;//from ww w .ja v a 2s . c o m gc.weighty = 1.0; // get the first part try { BodyPart bp = mp.getBodyPart(0); Component comp = getComponent(bp); add(comp, gc); } catch (MessagingException me) { add(new Label(me.toString()), gc); } // see if there are more than one parts try { int count = mp.getCount(); // setup how to display them gc.gridwidth = GridBagConstraints.REMAINDER; gc.gridheight = 1; gc.fill = GridBagConstraints.NONE; gc.anchor = GridBagConstraints.NORTH; gc.weightx = 0.0; gc.weighty = 0.0; gc.insets = new Insets(4, 4, 4, 4); // for each one we create a button with the content type for (int i = 1; i < count; i++) { // we skip the first one BodyPart curr = mp.getBodyPart(i); String label = null; if (label == null) label = curr.getFileName(); if (label == null) label = curr.getDescription(); if (label == null) label = curr.getContentType(); Button but = new Button(label); but.addActionListener(new AttachmentViewer(curr)); add(but, gc); } } catch (MessagingException me2) { me2.printStackTrace(); } }
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 w w.j a va 2 s .c o m*/ 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); }