javax.swing.JToolBar.<init>()方法的使用及代码示例

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

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

JToolBar.<init>介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Create the default toolbar representation of an array of actions.
* Null items in the array will add a separator to the toolbar.
*
* @param actions actions to show in the generated toolbar
* @return a toolbar instance displaying them
*/
public static JToolBar createToolbarPresenter(SystemAction[] actions) {
  JToolBar p = new JToolBar();
  for (SystemAction action : actions) {
    if (action == null) {
      p.addSeparator();
    } else if (action instanceof Presenter.Toolbar) {
      p.add(((Presenter.Toolbar) action).getToolbarPresenter());
    }
  }
  return p;
}

代码示例来源:origin: log4j/log4j

protected JToolBar createToolBar() {
 JToolBar tb = new JToolBar();
 tb.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
 JComboBox fontCombo = new JComboBox();
 JButton newButton = new JButton("Clear Log Table");
 tb.add(new JLabel(" Font: "));
 tb.add(fontCombo);
 tb.add(fontSizeCombo);
 tb.addSeparator();
 tb.addSeparator();

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

final JFrame frame = new JFrame();
frame.setPreferredSize(new Dimension(600, 400));
final JToolBar toolBar = new JToolBar();
final JButton button = new JButton("Options");
button.addMouseListener(new MouseAdapter() {
  public void mousePressed(MouseEvent e) {

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

JToolBar jToolBar = new JToolBar();
JButton jButtonFileOpen = new JButton();
jToolBar.add(jButtonFileOpen);

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

f.add(variantPanel("regular"));
f.add(variantPanel("large"));
JPanel customPanel = new JPanel();
customPanel.add(createCustom("One"));
customPanel.add(createCustom("Two"));
JPanel variantPanel = new JPanel();
variantPanel.add(createVariant("One", size));
variantPanel.add(createVariant("Two", size));
JButton b = new JButton(name);
b.putClientProperty("JComponent.sizeVariant", size);
return b;
JToolBar bar = new JToolBar("L&F");
bar.setLayout(new FlowLayout(FlowLayout.LEFT));
bar.add(combo);

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

Component comp = null;
String cls_name = "test";  // include your package ie "java.lang.String"

try {
  Class cls = Class.forName(cls_name);
  Object obj = cls.newInstance();

  if (obj instanceof Component) {
    comp = (Component) obj;
  }
}
catch (Exception err) {
  err.printStackTrace();
}

setLayout(new BorderLayout() );

JToolBar toolbar = new JToolBar();
if (comp != null) {
  toolbar.add(comp);
}

add(toolbar, BorderLayout.NORTH);

代码示例来源:origin: uk.org.mygrid.taverna.scufl/scufl-ui

private void initComponents(ScuflModel model, WorkflowInstance workflowInstance)
{
  setLayout(new BorderLayout());
  resultTable = new ResultTable(model, workflowInstance);
  
  JToolBar toolbar = new JToolBar();
  toolbar.setFloatable(false);
  toolbar.setRollover(true);		
  
  JScrollPane pane = new JScrollPane();
  pane.setViewportView(resultTable);
  pane.setPreferredSize(new Dimension(0, 0));
  
  split = new JSplitPane();
  split.setLeftComponent(pane);
  split.setRightComponent(null);
  split.setResizeWeight(0.8);
  
  add(split, BorderLayout.CENTER);
  resultTable.addTableSelectionListener(this);		
}

代码示例来源:origin: akquinet/jbosscc-as7-examples

/**
 * Default constructor that populates the main window.
 **/
public PaintFrame() {
  super("PaintFrame");
  m_toolbar = new JToolBar("Toolbar");
  m_panel = new JPanel();
  m_panel.setBackground(Color.WHITE);
  m_panel.setLayout(null);
  m_panel.setMinimumSize(new Dimension(400, 400));
  m_panel.addMouseListener(this);
  getContentPane().setLayout(new BorderLayout());
  getContentPane().add(m_toolbar, BorderLayout.NORTH);
  getContentPane().add(m_panel, BorderLayout.CENTER);
  setSize(400, 400);
}

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

toolBarPanel = new JPanel();
toolBarPanel.add(jToolbar = new JToolBar());

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

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
loadI = new JMenuItem("Load"); //menuitems
statusI = new JMenuItem("Status"); //menuitems
toolBar = new JToolBar();

代码示例来源:origin: net.sf.taverna.t2.ui-impl/workbench-impl

protected JPanel makeToolbarPanel() {
  JPanel toolbarPanel = new JPanel(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.gridx = 0;
  gbc.gridy = 0;
  gbc.gridwidth = 2;
  gbc.anchor = GridBagConstraints.LINE_START;
  JToolBar generatedToolbar = menuManager.createToolBar();
  generatedToolbar.setFloatable(false);
  toolbarPanel.add(generatedToolbar, gbc);
  perspectiveToolBar = new JToolBar("Perspectives");
  perspectiveToolBar.setFloatable(false);
  gbc.gridy = 1;
  gbc.weightx = 0.1;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  toolbarPanel.add(perspectiveToolBar, gbc);
  return toolbarPanel;
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected JToolBar createToolBar() {
 JToolBar tb = new JToolBar();
 tb.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
 JComboBox fontCombo = new JComboBox();
 JButton newButton = new JButton("Clear Log Table");

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

JToolBar toolbar=new JToolBar();
toolbar.setFloatable(false);

...
toolbar.add(YourCompoenthere);

...

代码示例来源:origin: org.netbeans.api/org-openide-awt

/**
 * Creates a new tool bar with a specified
 * <code>name</code> and
 * <code>orientation</code>. All other constructors call this constructor.
 * If
 * <code>orientation</code> is an invalid value, an exception will be
 * thrown.
 *
 * @param name the name of the tool bar
 * @param orientation the initial orientation -- it must be     *        either <code>HORIZONTAL</code> or <code>VERTICAL</code>
 * @exception IllegalArgumentException if orientation is neither
 * <code>HORIZONTAL</code> nor <code>VERTICAL</code>
 */
public ToolbarWithOverflow(String name, int orientation) {
  super(name, orientation);
  setupOverflowButton();
  popup = new JPopupMenu();
  popup.setBorderPainted(false);
  popup.setBorder(BorderFactory.createEmptyBorder());
  overflowToolbar = new JToolBar("overflowToolbar", orientation == HORIZONTAL ? VERTICAL : HORIZONTAL);
  overflowToolbar.setFloatable(false);
  overflowToolbar.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
}

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

JToolBar toolBar = new JToolBar(JToolBar.VERTICAL);
JLabel label = new JLabel(" ", JLabel.CENTER);
for (File f : files) {
    RecentFile rf = new RecentFile(f, label);
    menu.add(new JMenuItem(rf.getAction()));
    toolBar.add(rf.getAction());

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

private void buildTagPanel() {
 if (tagPanel == null) {
  tagPanel = new JToolBar(SwingConstants.VERTICAL);
  tagPanel.setFloatable(false);
  frame.getContentPane().add(tagPanel, BorderLayout.EAST);
 } else {
  tagPanel.removeAll();
 }
 if (classifier != null) {
  makeTagMaps();
  Set<String> tags = classifier.labels();
  String backgroundSymbol = classifier.backgroundSymbol();
  for (String tag : tags) {
   if (backgroundSymbol.equals(tag)) { continue; }
   Color color = tagToColorMap.get(tag);
   JButton b = new JButton(tag, new ColorIcon(color));
   tagPanel.add(b);
  }
 }
 tagPanel.revalidate();
 tagPanel.repaint();
}

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

JButton button1 = new JButton("+");
 JButton button2 = new JButton("-");
 JToolBar toolbar = new JToolBar();
 <JPanel,JFrame,Whatever>.add(toolbar, BorderLayout.SOUTH);
 toolbar.add(button1);
 toolbar.add(button2);

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

//Make a popup menu with one menu item
 final JPopupMenu popupMenu = new JPopupMenu();
 JMenuItem menuItem = new JMenuItem();
 //The panel contains the custom buttons
 JPanel panel = new JPanel();
 panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
 panel.setAlignmentX(Component.LEFT_ALIGNMENT);       
 panel.add(Box.createHorizontalGlue());        
 JToolBar toolBar = new JToolBar();
 JButton toolBarButton = new JButton();
 toolBarButton.addActionListener(new ActionListener() {
   @Override
   public void actionPerformed(ActionEvent e) {
     popupMenu.setVisible(false); //hide the popup menu
     //other actions
   }
 });
 toolBar.setFloatable(false);
 toolBar.add(toolBarButton);
 panel.add(toolBar);
 //Put it all together        
 menuItem.add(panel);        
 menuItem.setPreferredSize(new Dimension(menuItem.getPreferredSize().width, panel.getPreferredSize().height)); //do this if your buttons are tall
 popupMenu.add(menuItem);

代码示例来源:origin: robo-code/robocode

private JToolBar getStatusBar() {
  if (statusBar == null) {
    statusBar = new JToolBar();
    statusBar.setLayout(new BorderLayout());
    statusBar.add(getLineLabel(), BorderLayout.WEST);
  }
  return statusBar;
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

CollapsedPanel(int dockableWindowLocation) {
  setLayout(new BorderLayout());
  int orientation = (dockableWindowLocation==DockableWindow.TOP ||
      dockableWindowLocation==DockableWindow.BOTTOM) ?
          JToolBar.HORIZONTAL : JToolBar.VERTICAL;
  toolbar = new JToolBar(orientation);
  toolbar.setOpaque(false);
  toolbar.setFloatable(false);
  toolbar.setBorder(null);
  //toolbar.add(new JButton(new RestoreAction()));
  refreshDockableWindowButtons();
  boolean isHorizontal = orientation==JToolBar.HORIZONTAL;
  add(toolbar, isHorizontal ?
      BorderLayout.LINE_END : BorderLayout.NORTH);
  setBorder(isHorizontal ? BorderFactory.createEmptyBorder(0, 0, 0, 5) :
    BorderFactory.createEmptyBorder(5, 0, 0, 0));
}

相关文章

JToolBar类方法