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