private JPanel makeBrowseButtonBox() { JPanel buttonBox = new JPanel(); buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); buttonBox.setLayout(new GridBagLayout()); browseButton = new JButton("Browse Trees"); browseButton.addActionListener(this); JLabel sizeLabel = new JLabel("Tree size:"); JSlider fontSlider = new JSlider(2, 64, 12); fontSlider.addChangeListener(this); GridBagConstraints buttonConstraints = new GridBagConstraints(); buttonConstraints.fill = GridBagConstraints.HORIZONTAL; buttonConstraints.weightx = 0.2; buttonConstraints.weighty = 0.2; buttonBox.add(browseButton,buttonConstraints); buttonConstraints.weightx = 0.6; buttonBox.add(fontSlider, buttonConstraints); buttonConstraints.weightx = 0.2; buttonBox.add(sizeLabel, buttonConstraints); return buttonBox; }
private JPanel makeTSurgeonButtons() { JPanel tsurgeonButtonBox = new JPanel(); tsurgeonButtonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); tsurgeonButtonBox.setLayout(new GridBagLayout()); tsurgeonHelp = new JButton("Help"); tsurgeonHelp.addActionListener(this); cancelTsurgeon = new JButton("Cancel"); cancelTsurgeon.addActionListener(this); runScript = new JButton("Run script"); runScript.addActionListener(this); //make constraints and add in GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHEAST; c.fill = GridBagConstraints.HORIZONTAL; tsurgeonButtonBox.add(runScript,c); tsurgeonButtonBox.add(cancelTsurgeon,c); tsurgeonButtonBox.add(tsurgeonHelp,c); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; c.weighty = 1.0; tsurgeonButtonBox.add(new JLabel(), c); return tsurgeonButtonBox; } //separated out to make constructor more readable
private JPanel makeTregexButtonBox() { JPanel buttonBox = new JPanel(); buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); buttonBox.setLayout(new GridBagLayout());
/** * {@inheritDoc} */ @Override public void setComponentOrientation(ComponentOrientation o) { // Some LaFs might do fun stuff, resulting in this method being called // before a border is installed. if (getBorder() instanceof GutterBorder) { // Reuse the border to preserve its color. if (o.isLeftToRight()) { ((GutterBorder)getBorder()).setEdges(0, 0, 0, 1); } else { ((GutterBorder)getBorder()).setEdges(0, 1, 0, 0); } } super.setComponentOrientation(o); }
JPanel panel = new JPanel(); //Flow layout by default //If you want to anchor the buttons to the right you might try panel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); panel.add(okButton); panel.add(cancelButton);
private JPanel makeBrowseButtonBox() { JPanel buttonBox = new JPanel(); buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); buttonBox.setLayout(new GridBagLayout()); browseButton = new JButton("Browse Trees"); browseButton.addActionListener(this); JLabel sizeLabel = new JLabel("Tree size:"); JSlider fontSlider = new JSlider(2, 64, 12); fontSlider.addChangeListener(this); GridBagConstraints buttonConstraints = new GridBagConstraints(); buttonConstraints.fill = GridBagConstraints.HORIZONTAL; buttonConstraints.weightx = 0.2; buttonConstraints.weighty = 0.2; buttonBox.add(browseButton,buttonConstraints); buttonConstraints.weightx = 0.6; buttonBox.add(fontSlider, buttonConstraints); buttonConstraints.weightx = 0.2; buttonBox.add(sizeLabel, buttonConstraints); return buttonBox; }
private JPanel makeTSurgeonButtons() { JPanel tsurgeonButtonBox = new JPanel(); tsurgeonButtonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); tsurgeonButtonBox.setLayout(new GridBagLayout()); tsurgeonHelp = new JButton("Help"); tsurgeonHelp.addActionListener(this); cancelTsurgeon = new JButton("Cancel"); cancelTsurgeon.addActionListener(this); runScript = new JButton("Run script"); runScript.addActionListener(this); //make constraints and add in GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.NORTHEAST; c.fill = GridBagConstraints.HORIZONTAL; tsurgeonButtonBox.add(runScript,c); tsurgeonButtonBox.add(cancelTsurgeon,c); tsurgeonButtonBox.add(tsurgeonHelp,c); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; c.weighty = 1.0; tsurgeonButtonBox.add(new JLabel(), c); return tsurgeonButtonBox; } //separated out to make constructor more readable
private JPanel makeTregexButtonBox() { JPanel buttonBox = new JPanel(); buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); buttonBox.setLayout(new GridBagLayout());
panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
panel3.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); panel3.setBorder(LineBorder.createBlackLineBorder()); panel3.setLayout(new FlowLayout(FlowLayout.LEFT));
GuiMessages.get("Consensus"), TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); consensus.setLayout(new GridLayout(5, 2, 0, 8)); consensus.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
/** * {@inheritDoc} */ @Override public void setComponentOrientation(ComponentOrientation o) { // Some LaFs might do fun stuff, resulting in this method being called // before a border is installed. if (getBorder() instanceof GutterBorder) { // Reuse the border to preserve its color. if (o.isLeftToRight()) { ((GutterBorder)getBorder()).setEdges(0, 0, 0, 1); } else { ((GutterBorder)getBorder()).setEdges(0, 1, 0, 0); } } super.setComponentOrientation(o); }
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (getModel().isLeaf(value)) { return leafRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); } Object renderedValue = ModelerUtil.getObjectName(value); if (renderedValue == null) { // render NULL as empty string renderedValue = " "; } Component text = nonLeafTextRenderer.getListCellRendererComponent(list, renderedValue, index, isSelected, cellHasFocus); nonLeafPanel.setComponentOrientation(text.getComponentOrientation()); nonLeafPanel.setBackground(text.getBackground()); nonLeafPanel.setForeground(text.getForeground()); nonLeafPanel.setEnabled(text.isEnabled()); return nonLeafPanel; } }