public static void init( JToolBar comp, Thing thing, Container parent, ActionContext actionContext) { JComponentCreator.init(comp, thing, parent, actionContext); Boolean borderPainted = JavaCreator.createBoolean(thing, "borderPainted"); if (borderPainted != null) { comp.setBorderPainted(borderPainted); } Boolean floatable = JavaCreator.createBoolean(thing, "floatable"); if (floatable != null) { comp.setFloatable(floatable); } Insets margin = AwtCreator.createInsets(thing, "margin", actionContext); if (margin != null) { comp.setMargin(margin); } Integer orientation = null; String v = thing.getString("orientation"); if ("HORIZONTAL".equals(v)) { orientation = JToolBar.HORIZONTAL; } else if ("VERTICAL".equals(v)) { orientation = JToolBar.VERTICAL; } if (orientation != null) { comp.setOrientation(orientation); } Boolean rollover = JavaCreator.createBoolean(thing, "rollover"); if (rollover != null) { comp.setRollover(rollover); } }
@Override public void run() { ArrayList<ArrayList<Integer>> paths = new ArrayList<ArrayList<Integer>>(); buttonOpen = new JButton("Open file"); buttonOpen.addActionListener(new openFile()); openFileL = new JLabel("Open file..."); frame = new JFrame("SRPP PROJECT"); frame.setPreferredSize(new Dimension(510, 590)); frame.setResizable(false); JToolBar bar1 = new JToolBar(); bar1.setFloatable(false); bar1.add(buttonOpen); bar1.add(openFileL); bar1.setMargin(new Insets(5, 5, 5, 5)); frame.add(bar1, BorderLayout.NORTH); drawPanel = new DrawPanel(cities, paths, magazine); frame.add(drawPanel, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
/** Creates and displays the main GUI This GUI has the list and the main * buttons */ public void showGUI() { final JScrollPane scrollPane = new JScrollPane(); table = new JTable( new DefaultTableModel( new Object[][] {}, new String[] {"Username", "Password", "Pin", "Reward"})); AccountManager.loadAccounts(); if (AccountManager.hasAccounts()) { for (Account account : AccountManager.getAccounts()) { ((DefaultTableModel) table.getModel()) .addRow( new Object[] { account.getUsername(), account.getReward(), account.getPin(), account.getReward() }); } } final JToolBar bar = new JToolBar(); bar.setMargin(new Insets(1, 1, 1, 1)); bar.setFloatable(false); removeButton = new JButton("Remove"); final JButton newButton = new JButton("Add"); final JButton doneButton = new JButton("Save"); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener(new TableSelectionListener()); table.setShowGrid(true); final TableColumnModel cm = table.getColumnModel(); cm.getColumn(cm.getColumnIndex("Password")).setCellRenderer(new PasswordCellRenderer()); cm.getColumn(cm.getColumnIndex("Password")).setCellEditor(new PasswordCellEditor()); cm.getColumn(cm.getColumnIndex("Pin")).setCellRenderer(new PasswordCellRenderer()); cm.getColumn(cm.getColumnIndex("Pin")).setCellEditor(new PasswordCellEditor()); cm.getColumn(cm.getColumnIndex("Reward")).setCellEditor(new RandomRewardEditor()); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(table); add(scrollPane, BorderLayout.CENTER); newButton.setFocusable(false); newButton.setToolTipText(newButton.getText()); newButton.setText("+"); bar.add(newButton); removeButton.setFocusable(false); removeButton.setToolTipText(removeButton.getText()); removeButton.setText("-"); bar.add(removeButton); bar.add(Box.createHorizontalGlue()); doneButton.setToolTipText(doneButton.getText()); bar.add(doneButton); newButton.addActionListener(this); removeButton.addActionListener(this); doneButton.addActionListener(this); add(bar, BorderLayout.SOUTH); final int row = table.getSelectedRow(); removeButton.setEnabled(row >= 0 && row < table.getRowCount()); table.clearSelection(); doneButton.requestFocus(); setPreferredSize(new Dimension(600, 300)); pack(); setLocationRelativeTo(getOwner()); setResizable(false); }
/** kreiert das Menü oben */ private JToolBar createMenu() { JToolBar toolbar = new JToolBar(); toolbar.setOrientation(SwingConstants.HORIZONTAL); toolbar.setFloatable(false); toolbar.setMargin(new Insets(2, 35, 2, 0)); toolbar.setBackground(new Color(219, 255, 179)); zoomIn = FsmUtils.createButton(zoomInImg); zoomIn.setToolTipText("Vergr��ern"); zoomIn.addMouseListener(new ZoomInHandler(this)); zoomOut = FsmUtils.createButton(zoomOutImg); zoomOut.setToolTipText("Verkleinern"); zoomOut.addMouseListener(new ZoomOutHandler(this)); layout = FsmUtils.createButton(layoutImg); layout.setToolTipText("Automatisch layouten"); layout.addMouseListener(new LayoutHandler(this)); deterministic = new JRadioButton("deterministisch"); deterministic.setToolTipText("Der endliche Automat wird deterministisch"); deterministic.setBackground(new Color(219, 255, 179)); deterministic.addMouseListener(new TypeOfFsmHandler(this, false)); nondeterministic = new JRadioButton("nichtdeterministisch"); nondeterministic.setToolTipText("Der endliche Automat wird nichtdeterministisch"); nondeterministic.setBackground(new Color(219, 255, 179)); nondeterministic.addMouseListener(new TypeOfFsmHandler(this, true)); ButtonGroup group = new ButtonGroup(); group.add(deterministic); group.add(nondeterministic); if (this.getFsmProgram().isNondeterministic()) { group.setSelected(nondeterministic.getModel(), true); } else { group.setSelected(deterministic.getModel(), true); } toolbar.add(zoomIn); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(zoomOut); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(layout); toolbar.addSeparator(); toolbar.add(deterministic); toolbar.add(nondeterministic); return toolbar; }
/** * Static component init. * * <pre> * - panel * - northPanel * - parameterPanel * - toolBar * - gridController * - confirmPanel * - statusBar * </pre> * * @throws Exception */ void jbInit() throws Exception { // [ 1707303 ] Account Combination Form(VAccountDialog) translation issue titledBorder = new TitledBorder( BorderFactory.createEtchedBorder(Color.white, new Color(134, 134, 134)), Msg.getMsg(Env.getCtx(), "Parameter")); // panelLayout.setHgap(5); panelLayout.setVgap(5); northLayout.setHgap(5); northLayout.setVgap(5); // parameterPanel.setLayout(parameterLayout); parameterPanel.setBorder(titledBorder); northPanel.setLayout(northLayout); toolBar.setOrientation(JToolBar.VERTICAL); toolBar.setBorder(null); toolBar.setRequestFocusEnabled(false); toolBar.setBorderPainted(false); toolBar.setMargin(new Insets(5, 5, 5, 5)); bSave.setIcon(new ImageIcon(ResourceFinder.getResource("images/Save24.gif"))); bSave.setMargin(new Insets(2, 2, 2, 2)); bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AccountNewUpdate")); bSave.addActionListener(this); bRefresh.setIcon(new ImageIcon(ResourceFinder.getResource("images/Refresh24.gif"))); bRefresh.setMargin(new Insets(2, 2, 2, 2)); bRefresh.setToolTipText(Msg.getMsg(Env.getCtx(), "Refresh")); bRefresh.addActionListener(this); bIgnore.setIcon(new ImageIcon(ResourceFinder.getResource("images/Ignore24.gif"))); bIgnore.setMargin(new Insets(2, 2, 2, 2)); bIgnore.setToolTipText(Msg.getMsg(Env.getCtx(), "Ignore")); bIgnore.addActionListener(this); // toolBar.addSeparator(); toolBar.add(bRefresh, null); toolBar.add(bIgnore, null); toolBar.add(bSave, null); // getContentPane().add(panel); panel.setLayout(panelLayout); panel.add(confirmPanel, BorderLayout.SOUTH); panel.add(northPanel, BorderLayout.NORTH); northPanel.add(parameterPanel, BorderLayout.CENTER); northPanel.add(toolBar, BorderLayout.EAST); // this.getContentPane().add(statusBar, BorderLayout.SOUTH); confirmPanel.addActionListener(this); } // jbInit
private JToolBar createToolBar() { JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL); toolBar.setMargin(new Insets(0, 0, 0, 2)); toolBar.setFloatable(false); // Add actions (and thus buttons) toolBar.add(this.closeAction); toolBar.addSeparator(); toolBar.add(this.copyPreviewAction); toolBar.addSeparator(); toolBar.add(this.printAction); Component[] comps = toolBar.getComponents(); for (Component comp : comps) { ((JComponent) comp).setOpaque(false); } return toolBar; }
/** Erstellt das Menü auf der linken Seite */ private JToolBar createFSMMenu() { JToolBar toolbar = new JToolBar(); toolbar.setOrientation(SwingConstants.VERTICAL); toolbar.setFloatable(false); toolbar.setMargin(new Insets(5, -3, 0, 2)); toolbar.setBackground(new Color(219, 255, 179)); editMode = FsmUtils.createToggleButton(editImg); editMode.setToolTipText("Editieren"); editMode.addMouseListener(new EditModeHandler(this.automataPanel)); deleteMode = FsmUtils.createToggleButton(deleteImg); deleteMode.setToolTipText("L�schen"); deleteMode.addMouseListener(new DeleteModeHandler(this.automataPanel)); createState = FsmUtils.createToggleButton(createStateImg); createState.setToolTipText("Zustand erzeugen"); createState.addMouseListener(new CreateStateHandler(this.automataPanel)); markStartState = FsmUtils.createToggleButton(markStartStateImg); markStartState.setToolTipText("Startzustand markieren"); markStartState.addMouseListener(new MarkStartStateHandler(this.automataPanel)); markFinalState = FsmUtils.createToggleButton(markFinalStateImg); markFinalState.setToolTipText("Endzustand markieren"); markFinalState.addMouseListener(new MarkFinalStateHandler(this.automataPanel)); createTransistion = FsmUtils.createToggleButton(createTransistionImg); createTransistion.setToolTipText("Transition erzeugen"); createTransistion.addMouseListener(new CreateTransistionHandler(this.automataPanel)); createComment = FsmUtils.createToggleButton(createCommentImg); createComment.setToolTipText("Kommentar erzeugen"); createComment.addMouseListener(new CreateCommentHandler(this.automataPanel)); // Nur ein Button darf aktiv sein ButtonGroup group = new ButtonGroup(); group.add(editMode); group.add(deleteMode); group.add(createState); group.add(markStartState); group.add(markFinalState); group.add(createTransistion); group.add(createComment); group.setSelected(editMode.getModel(), true); toolbar.add(editMode); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(deleteMode); toolbar.addSeparator(); toolbar.add(createState); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(markStartState); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(markFinalState); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(createTransistion); toolbar.add(Box.createVerticalStrut(2)); toolbar.add(createComment); return toolbar; }