Java Code Examples for javax.swing.JPanel.setAlignmentY()
The following are Jave code examples for showing how to use
setAlignmentY() of the
javax.swing.JPanel
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: VASSAL-src File: TurnTracker.java View Source Code | 5 votes |
public void addTo(Buildable b) { //Create the turn window turnWindow = new TurnWindow(); turnWindow.pack(); turnWindow.setVisible(false); launchWidget = new JPanel(); launchWidget.setLayout(new BorderLayout()); launchWidget.setBorder(BorderFactory.createEtchedBorder()); GameModule.getGameModule().getToolBar().add(launchWidget); launchWidget.setAlignmentY(0.0F); launchWidget.setVisible(false); GameModule.getGameModule().getToolBar().add(launch); launch.setAlignmentY(0.0F); launch.setEnabled(false); setDocked(isDocked()); GameModule.getGameModule().addCommandEncoder(this); GameModule.getGameModule().getGameState().addGameComponent(this); idMgr.add(this); //Global Property support lastCommand.addTo((MutablePropertiesContainer) b); lastTurn.addTo((MutablePropertiesContainer) b); }
Example 2
Project: org.alloytools.alloy File: VizGUI.java View Source Code | 5 votes |
/** Add a vertical divider to the toolbar. */ private void addDivider() { JPanel divider = OurUtil.makeH(new Dimension(1, 40), Color.LIGHT_GRAY); divider.setAlignmentY(0.5f); if (!Util.onMac()) toolbar.add(OurUtil.makeH(5, background)); else toolbar.add(OurUtil.makeH(5)); toolbar.add(divider); if (!Util.onMac()) toolbar.add(OurUtil.makeH(5, background)); else toolbar.add(OurUtil.makeH(5)); }
Example 3
Project: Tarski File: VizGUI.java View Source Code | 5 votes |
/** Add a vertical divider to the toolbar. */ private void addDivider() { JPanel divider = OurUtil.makeH(new Dimension(1, 40), Color.LIGHT_GRAY); divider.setAlignmentY(0.5f); if (!Util.onMac()) toolbar.add(OurUtil.makeH(5,background)); else toolbar.add(OurUtil.makeH(5)); toolbar.add(divider); if (!Util.onMac()) toolbar.add(OurUtil.makeH(5,background)); else toolbar.add(OurUtil.makeH(5)); }
Example 4
Project: Tarski File: OurTabbedSyntaxWidget.java View Source Code | 5 votes |
/** Create a new tab with the given filename (if filename==null, we'll create a blank tab instead) * <p> If a text buffer with that filename already exists, we will just switch to it; else we'll read that file into a new tab. * @return false iff an error occurred */ public boolean newtab(String filename) { if (filename!=null) { filename = Util.canon(filename); for(int i=0; i<tabs.size(); i++) if (tabs.get(i).getFilename().equals(filename)) { if (i!=me) select(i); return true; } } final JLabel lb = OurUtil.label("", OurUtil.getVizFont().deriveFont(Font.BOLD), Color.BLACK, Color.WHITE); lb.setBorder(new OurBorder(BORDER, BORDER, Color.WHITE, BORDER)); lb.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { for(int i=0; i<tabs.size(); i++) if (tabs.get(i).obj1 == lb) select(i); } }); JPanel h1 = OurUtil.makeH(4); h1.setBorder(new OurBorder(null, null, BORDER, null)); JPanel h2 = OurUtil.makeH(3); h2.setBorder(new OurBorder(null, null, BORDER, null)); JPanel pan = Util.onMac() ? OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2)) : OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2, GRAY), GRAY); pan.setAlignmentX(0.0f); pan.setAlignmentY(1.0f); OurSyntaxWidget text = new OurSyntaxWidget(syntaxHighlighting, "", fontName, fontSize, tabSize, lb, pan); tabBar.add(pan, tabs.size()); tabs.add(text); text.listeners.add(listener); // add listener AFTER we've updated this.tabs and this.tabBar if (filename==null) { text.discard(false, getFilenames()); // forces the tab to re-derive a suitable fresh name } else { if (!text.load(filename)) return false; for(int i=tabs.size()-1; i>=0; i--) if (!tabs.get(i).isFile() && tabs.get(i).getText().length()==0) { tabs.get(i).discard(false, getFilenames()); close(i); break; // Remove the rightmost untitled empty tab } } select(tabs.size() - 1); // Must call this to switch to the new tab; and it will fire STATUS_CHANGE message which is important return true; }
Example 5
Project: hml File: MyPanel.java View Source Code | 5 votes |
public JPanel createHorizontalPanel(boolean threeD) { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.setAlignmentY(TOP_ALIGNMENT); p.setAlignmentX(LEFT_ALIGNMENT); if(threeD) { p.setBorder(loweredBorder); } return p; }
Example 6
Project: hml File: MyPanel.java View Source Code | 5 votes |
public JPanel createVerticalPanel(boolean threeD) { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setAlignmentY(TOP_ALIGNMENT); p.setAlignmentX(LEFT_ALIGNMENT); if(threeD) { p.setBorder(loweredBorder); } return p; }
Example 7
Project: incubator-netbeans File: VCSCommitParameters.java View Source Code | 4 votes |
public ParametersPanel() { messageLabel.setLabelFor(messageTextArea); Mnemonics.setLocalizedText(messageLabel, getMessage("CTL_CommitForm_Message")); // NOI18N JLabel templateLink = getMessagesTemplateLink(messageTextArea, "org.netbeans.modules.versioning.util.common.TemplatePanel"); //NOI18N JLabel recentLink = getRecentMessagesLink(messageTextArea); messageTextArea.setColumns(60); //this determines the preferred width of the whole dialog messageTextArea.setLineWrap(true); messageTextArea.setRows(4); messageTextArea.setTabSize(4); messageTextArea.setWrapStyleWord(true); messageTextArea.setMinimumSize(new Dimension(100, 18)); scrollpane.setViewportView(messageTextArea); messageTextArea.getAccessibleContext().setAccessibleName(getMessage("ACSN_CommitForm_Message")); // NOI18N messageTextArea.getAccessibleContext().setAccessibleDescription(getMessage("ACSD_CommitForm_Message")); // NOI18N if(commitMessage != null) { messageTextArea.setText(commitMessage); } JPanel topPanel = new VerticallyNonResizingPanel(); topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS)); topPanel.add(messageLabel); topPanel.add(Box.createHorizontalGlue()); topPanel.add(recentLink); topPanel.add(makeHorizontalStrut(recentLink, templateLink, RELATED, this)); topPanel.add(templateLink); messageLabel.setAlignmentX(LEFT_ALIGNMENT); messageLabel.setAlignmentY(BOTTOM_ALIGNMENT); recentLink.setAlignmentY(BOTTOM_ALIGNMENT); templateLink.setAlignmentY(BOTTOM_ALIGNMENT); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); topPanel.setAlignmentY(BOTTOM_ALIGNMENT); add(topPanel); add(makeVerticalStrut(messageLabel, scrollpane, RELATED, this)); add(scrollpane); Spellchecker.register (messageTextArea); }
Example 8
Project: QN-ACTR-Release File: InputSectionPanel.java View Source Code | 4 votes |
private void initComponents() { this.setBorder(new EmptyBorder(5, 5, 5, 5)); this.setLayout(new BorderLayout(5, 5)); infiniteQueueSelector = new JRadioButton("infinite"); finiteQueueSelector = new JRadioButton("finite"); queueLengthGroup = new ButtonGroup(); queueLengthGroup.add(infiniteQueueSelector); queueLengthGroup.add(finiteQueueSelector); queueLengthSpinner = new JSpinner(); queueLengthSpinner.setValue(new Integer(1)); queueLengthSpinner.setPreferredSize(DIM_BUTTON_XS); queueTable = new QueueTable(); //queue details panel JPanel queuePolicyPanel = new JPanel(new BorderLayout()); queuePolicyPanel.setBorder(new TitledBorder(new EtchedBorder(), "Queue Policy")); queuePolicyPanel.add(new WarningScrollTable(queueTable, WARNING_CLASS), BorderLayout.CENTER); JPanel queueLengthPanel = new JPanel(new GridLayout(3, 1, 3, 3)); queueLengthPanel.setBorder(new TitledBorder(new EtchedBorder(), "Capacity")); // Queue strategy selector JPanel queueStrategy = new JPanel(new BorderLayout()); queueStrategy.add(new JLabel("Station queue policy: "), BorderLayout.WEST); queuePolicyCombo = new JComboBox(); queueStrategy.add(queuePolicyCombo, BorderLayout.CENTER); queuePolicyPanel.add(queueStrategy, BorderLayout.NORTH); queueStrategy.setBorder(BorderFactory.createEmptyBorder(2, 5, 10, 5)); queueLengthPanel.setAlignmentY(Component.BOTTOM_ALIGNMENT); queueLengthPanel.add(infiniteQueueSelector); queueLengthPanel.add(finiteQueueSelector); JPanel spinnerPanel = new JPanel(); new BoxLayout(spinnerPanel, BoxLayout.Y_AXIS); JLabel label = new JLabel("max num.customers: "); label.setToolTipText("The maximum number of customers allowed in the station."); spinnerPanel.add(label); spinnerPanel.add(queueLengthSpinner); queueLengthPanel.add(spinnerPanel); this.add(queueLengthPanel, BorderLayout.WEST); this.add(queuePolicyPanel, BorderLayout.CENTER); }
Example 9
Project: org.alloytools.alloy File: OurTabbedSyntaxWidget.java View Source Code | 4 votes |
/** * Create a new tab with the given filename (if filename==null, we'll create * a blank tab instead) * <p> * If a text buffer with that filename already exists, we will just switch * to it; else we'll read that file into a new tab. * * @return false iff an error occurred */ public boolean newtab(String filename) { if (filename != null) { filename = Util.canon(filename); for (int i = 0; i < tabs.size(); i++) if (tabs.get(i).getFilename().equals(filename)) { if (i != me) select(i); return true; } } final JLabel lb = OurUtil.label("", OurUtil.getVizFont().deriveFont(Font.BOLD), Color.BLACK, Color.WHITE); lb.setBorder(new OurBorder(BORDER, BORDER, Color.WHITE, BORDER)); lb.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { for (int i = 0; i < tabs.size(); i++) if (tabs.get(i).obj1 == lb) select(i); } }); JPanel h1 = OurUtil.makeH(4); h1.setBorder(new OurBorder(null, null, BORDER, null)); JPanel h2 = OurUtil.makeH(3); h2.setBorder(new OurBorder(null, null, BORDER, null)); JPanel pan = Util.onMac() ? OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2)) : OurUtil.makeVL(null, 2, OurUtil.makeHB(h1, lb, h2, GRAY), GRAY); pan.setAlignmentX(0.0f); pan.setAlignmentY(1.0f); OurSyntaxWidget text = new OurSyntaxWidget(syntaxHighlighting, "", fontName, fontSize, tabSize, lb, pan); tabBar.add(pan, tabs.size()); tabs.add(text); text.listeners.add(listener); // add listener AFTER we've updated // this.tabs and this.tabBar if (filename == null) { text.discard(false, getFilenames()); // forces the tab to re-derive // a suitable fresh name } else { if (!text.load(filename)) return false; for (int i = tabs.size() - 1; i >= 0; i--) if (!tabs.get(i).isFile() && tabs.get(i).getText().length() == 0) { tabs.get(i).discard(false, getFilenames()); close(i); break; // Remove the rightmost untitled empty tab } } select(tabs.size() - 1); // Must call this to switch to the new tab; and // it will fire STATUS_CHANGE message which // is important return true; }