javax.swing.JPanel.setComponentOrientation()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中javax.swing.JPanel.setComponentOrientation()方法的一些代码示例,展示了JPanel.setComponentOrientation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.setComponentOrientation()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:setComponentOrientation

JPanel.setComponentOrientation介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

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;
}

代码示例来源:origin: stanfordnlp/CoreNLP

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

代码示例来源:origin: stanfordnlp/CoreNLP

private JPanel makeTregexButtonBox() {
 JPanel buttonBox = new JPanel();
 buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
 buttonBox.setLayout(new GridBagLayout());

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * {@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);
}

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

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;
}

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

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

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

private JPanel makeTregexButtonBox() {
 JPanel buttonBox = new JPanel();
 buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
 buttonBox.setLayout(new GridBagLayout());

代码示例来源:origin: stackoverflow.com

panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

代码示例来源:origin: igvteam/igv

panel3.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
panel3.setBorder(LineBorder.createBlackLineBorder());
panel3.setLayout(new FlowLayout(FlowLayout.LEFT));

代码示例来源:origin: semuxproject/semux-core

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);

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

/**
 * {@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);
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

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;
  }
}

相关文章

微信公众号

最新文章

更多

JPanel类方法