Search in sources :

Example 6 with JToolBar

use of javax.swing.JToolBar in project aima-java by aimacode.

the class AgentAppFrame method initComponents.

/** Assembles the inner structure of the frame. */
private void initComponents() {
    addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent evt) {
            System.exit(0);
        }
    });
    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new BorderLayout());
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    toolbar = new JToolBar();
    toolbar.setFloatable(false);
    selectors = new SelectorContainer();
    toolbar.add(Box.createHorizontalGlue());
    clearButton = new JButton("Clear");
    clearButton.setToolTipText("Clear Views");
    clearButton.addActionListener(actionListener);
    toolbar.add(clearButton);
    prepareButton = new JButton("Prepare");
    prepareButton.setToolTipText("Prepare Simulation");
    prepareButton.addActionListener(actionListener);
    toolbar.add(prepareButton);
    runButton = new JButton("Run");
    runButton.setToolTipText("Run Simulation");
    runButton.addActionListener(actionListener);
    toolbar.add(runButton);
    stepButton = new JButton("Step");
    stepButton.setToolTipText("Execute Simulation Step");
    stepButton.addActionListener(actionListener);
    toolbar.add(stepButton);
    pauseButton = new JToggleButton("Pause");
    pauseButton.setToolTipText("Pause Simulation");
    pauseButton.addActionListener(actionListener);
    toolbar.add(pauseButton);
    contentPanel.add(toolbar, java.awt.BorderLayout.NORTH);
    messageLogger = new MessageLoggerPanel();
    centerPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    centerPane.add(JSplitPane.RIGHT, messageLogger);
    centerPane.setDividerSize(5);
    centerPane.setResizeWeight(0.7);
    contentPanel.add(centerPane, BorderLayout.CENTER);
    JPanel statusPanel = new JPanel(new BorderLayout());
    statusLabel = new JLabel("");
    // BevelBorder
    statusLabel.setBorder(new javax.swing.border.EtchedBorder());
    statusPanel.add(statusLabel, BorderLayout.CENTER);
    cancelButton = new JButton("Cancel");
    cancelButton.setToolTipText("Cancel Simulation");
    cancelButton.addActionListener(actionListener);
    cancelButton.setPreferredSize(new java.awt.Dimension(80, 20));
    cancelButton.setBorder(new javax.swing.border.EtchedBorder());
    statusPanel.add(cancelButton, BorderLayout.EAST);
    contentPanel.add(statusPanel, BorderLayout.SOUTH);
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) BorderLayout(java.awt.BorderLayout) JToggleButton(javax.swing.JToggleButton) JSplitPane(javax.swing.JSplitPane)

Example 7 with JToolBar

use of javax.swing.JToolBar in project adempiere by adempiere.

the class VTreePanel method initTree.

/**
	 *  Tree initialization.
	 * 	May be called several times
	 *	@param	AD_Tree_ID	tree to load
	 *  @return true if loaded ok
	 */
public boolean initTree(int AD_Tree_ID, String whereClause) {
    log.config("AD_Tree_ID=" + AD_Tree_ID);
    //
    m_AD_Tree_ID = AD_Tree_ID;
    //	Yamel Senih [ 9223372036854775807 ]
    //	Add Where Clause
    //  Get Tree
    //		MTree vTree = new MTree (Env.getCtx(), AD_Tree_ID, m_editable, true, null);
    MTree vTree = new MTree(Env.getCtx(), AD_Tree_ID, m_editable, true, null);
    //	End Yamel Senih
    m_root = vTree.getRoot();
    // translate name of menu.
    m_root.setName(Msg.getMsg(Env.getCtx(), vTree.getName()));
    // m_root.setName(Msg.getMsg(Env.getCtx(), "Menu") ); // @Trifon; this is the hardcoded way.
    log.config("root=" + m_root);
    m_nodeTableName = vTree.getNodeTableName();
    treeModel = new AdempiereTreeModel(m_root, true);
    treeModel.setMTree(vTree);
    tree.setModel(treeModel);
    //  Shortcut Bar
    if (m_hasBar) {
        for (JToolBar jt : toolbar) jt.removeAll();
        toolbarMap = new HashMap<Integer, JToolBar>();
        Enumeration<?> enTop = m_root.children();
        JToolBar jt = null;
        Map<JToolBar, String> titleMap = new HashMap<JToolBar, String>();
        while (enTop.hasMoreElements()) {
            MTreeNode ndTop = (MTreeNode) enTop.nextElement();
            Enumeration<?> en = ndTop.preorderEnumeration();
            boolean labelDrawn = false;
            while (en.hasMoreElements()) {
                MTreeNode nd = (MTreeNode) en.nextElement();
                if (nd.isOnBar()) {
                    if (!labelDrawn) {
                        jt = new JToolBar(JToolBar.VERTICAL);
                        titleMap.put(jt, ndTop.toString().trim());
                        labelDrawn = true;
                        toolbarMap.put(ndTop.getNode_ID(), jt);
                    }
                    addToBar(nd, jt, false);
                }
            }
            if (jt != null)
                toolbar.add(jt);
            jt = null;
        }
        //jbInit();
        for (JToolBar jt2 : toolbar) {
            jt2.setOpaque(false);
            //jt2.setLayout(new GridBagLayout());
            jt2.setFloatable(false);
            jt2.setRollover(true);
            jt2.setBorder(BorderFactory.createEmptyBorder());
            JXTaskPane barPart = new JXTaskPane();
            //Begin - [FR 1953769]
            barPart.setUI(new AdempiereTaskPaneUI());
            barPart.getContentPane().setBackground(AdempierePLAF.getFormBackground());
            //End - [FR 1953769]
            barPart.setAnimated(true);
            barPart.setLayout(new BorderLayout());
            barPart.add(jt2, BorderLayout.NORTH);
            barPart.setTitle(titleMap.get(jt2));
            bar.add(barPart);
            //Begin - [FR 1953769]
            bar.setBackground(AdempierePLAF.getFormBackground());
        //End - [FR 1953769]
        }
    }
    return true;
}
Also used : MTreeNode(org.compiere.model.MTreeNode) AdempiereTaskPaneUI(org.adempiere.plaf.AdempiereTaskPaneUI) HashMap(java.util.HashMap) JToolBar(javax.swing.JToolBar) MTree(org.compiere.model.MTree) BorderLayout(java.awt.BorderLayout) JXTaskPane(org.jdesktop.swingx.JXTaskPane)

Example 8 with JToolBar

use of javax.swing.JToolBar in project adempiere by adempiere.

the class VTreePanel method getParentToolBar.

//  barAdd
/**
	 * Returns the top level parent JToolBar for the given MTreenode. If the parent is not on 
	 * the CPanel yet a new one is created and added.
	 * @param nd
	 * @return top level parent JToolBar for the given MTreenode
	 */
private JToolBar getParentToolBar(MTreeNode nd) {
    int topParentId = getTopParentId(nd);
    JToolBar parent = toolbarMap.get(topParentId);
    if (parent == null) {
        Enumeration<?> enTop = m_root.children();
        while (enTop.hasMoreElements()) {
            MTreeNode ndTop = (MTreeNode) enTop.nextElement();
            if (ndTop.getNode_ID() == topParentId) {
                log.fine("add new category: " + ndTop);
                parent = new JToolBar(JToolBar.VERTICAL);
                toolbarMap.put(ndTop.getNode_ID(), parent);
                toolbar.add(parent);
                parent.setOpaque(false);
                parent.setFloatable(false);
                parent.setRollover(true);
                parent.setBorder(BorderFactory.createEmptyBorder());
                JXTaskPane barPart = new JXTaskPane();
                //Begin - [FR 1953769]
                barPart.setUI(new AdempiereTaskPaneUI());
                barPart.getContentPane().setBackground(AdempierePLAF.getFormBackground());
                //End - [FR 1953769]
                barPart.setTitle(ndTop.toString().trim());
                barPart.setAnimated(true);
                barPart.setLayout(new BorderLayout());
                barPart.add(parent, BorderLayout.NORTH);
                bar.add(barPart);
                return parent;
            }
        }
    } else {
        log.fine("parent found: " + parent);
    }
    return parent;
}
Also used : MTreeNode(org.compiere.model.MTreeNode) AdempiereTaskPaneUI(org.adempiere.plaf.AdempiereTaskPaneUI) BorderLayout(java.awt.BorderLayout) JToolBar(javax.swing.JToolBar) JXTaskPane(org.jdesktop.swingx.JXTaskPane)

Example 9 with JToolBar

use of javax.swing.JToolBar in project platform_frameworks_base by android.

the class SwingUI method prepare.

@Override
public void prepare(ListModel<Client> clientListModel, TableModel dataTableModel, List<Action> actions) {
    getContentPane().add(new JScrollPane(clientList = new JList<Client>(clientListModel)), BorderLayout.WEST);
    clientList.setCellRenderer(new ClientListCellRenderer());
    // clientList.addListSelectionListener(listener);
    dataTable = new JTable(dataTableModel);
    getContentPane().add(new JScrollPane(dataTable), BorderLayout.CENTER);
    JToolBar toolbar = new JToolBar(JToolBar.HORIZONTAL);
    for (Action a : actions) {
        if (a == null) {
            toolbar.addSeparator();
        } else {
            toolbar.add(a);
        }
    }
    getContentPane().add(toolbar, BorderLayout.PAGE_START);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 800, 600);
    setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) Action(javax.swing.Action) JTable(javax.swing.JTable) JToolBar(javax.swing.JToolBar) Client(com.android.ddmlib.Client)

Example 10 with JToolBar

use of javax.swing.JToolBar in project smile by haifengl.

the class PlotPanel method initToolBar.

/**
     * Initialize toolbar.
     */
private void initToolBar() {
    toolbar = new JToolBar(JToolBar.VERTICAL);
    toolbar.setFloatable(false);
    add(toolbar, BorderLayout.WEST);
    JButton button = makeButton("save", SAVE, "Save", "Save");
    toolbar.add(button);
    button = makeButton("print", PRINT, "Print", "Print");
    toolbar.add(button);
}
Also used : JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar)

Aggregations

JToolBar (javax.swing.JToolBar)124 JButton (javax.swing.JButton)51 BorderLayout (java.awt.BorderLayout)45 JPanel (javax.swing.JPanel)37 JScrollPane (javax.swing.JScrollPane)30 Dimension (java.awt.Dimension)25 Insets (java.awt.Insets)25 ActionEvent (java.awt.event.ActionEvent)24 JLabel (javax.swing.JLabel)23 ActionListener (java.awt.event.ActionListener)19 ImageIcon (javax.swing.ImageIcon)17 Component (java.awt.Component)14 JSplitPane (javax.swing.JSplitPane)14 JTable (javax.swing.JTable)14 JTextField (javax.swing.JTextField)14 JPopupMenu (javax.swing.JPopupMenu)13 JToggleButton (javax.swing.JToggleButton)12 GridBagConstraints (java.awt.GridBagConstraints)10 GridBagLayout (java.awt.GridBagLayout)10 JComponent (javax.swing.JComponent)10