/* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenu getTestMenu() { if (ivjTestMenu == null) { try { ivjTestMenu = new javax.swing.JMenu(); ivjTestMenu.setName("TestMenu"); ivjTestMenu.setText("Test"); ivjTestMenu.setBackground(java.awt.SystemColor.control); ivjTestMenu.setActionCommand("FileMenu"); ivjTestMenu.add(getRunMenuItem()); ivjTestMenu.add(getSetupMenuItem()); ivjTestMenu.add(getResetMenuItem()); ivjTestMenu.add(getJSeparator1()); ivjTestMenu.add(getKillMenuItem()); ivjTestMenu.add(getStopMenuItem()); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjTestMenu; }
public CFrame() { super("Converter between Imperial and Metric."); setDefaultCloseOperation(EXIT_ON_CLOSE); JMenu menu = new JMenu("Application"); menu.setBackground(white); menu.setMnemonic(KeyEvent.VK_A); // quit item JMenuItem item = new JMenuItem("Quit"); item.setBackground(white); item.setMnemonic(KeyEvent.VK_Q); item.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.gc(); System.exit(0); } }); menu.add(item); JMenuBar menuBar = new JMenuBar(); menuBar.setBackground(white); menuBar.add(menu); setJMenuBar(menuBar); setVisible(true); } // end of CFrame constructor
public static JMenu getMenu(String title) { JMenu component = new JMenu(title); component.setBackground(BACKGROUND_COLOR_MENU); component.setFont(FONT_TYPE_TXTA); return component; }
/* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenu getLoadBuildMenu() { if (ivjLoadBuildMenu == null) { try { ivjLoadBuildMenu = new javax.swing.JMenu(); ivjLoadBuildMenu.setName("LoadBuildMenu"); ivjLoadBuildMenu.setText("Test Results"); ivjLoadBuildMenu.setBackground(java.awt.SystemColor.control); ivjLoadBuildMenu.setActionCommand("FileMenu"); ivjLoadBuildMenu.add(getRebuildTestsMenuItem()); ivjLoadBuildMenu.add(getResetModelsMenuItem()); ivjLoadBuildMenu.add(getJSeparator11()); ivjLoadBuildMenu.add(getLogResultsMenuItem()); ivjLoadBuildMenu.add(getJSeparator2()); ivjLoadBuildMenu.add(getSaveResultsMenuItem()); ivjLoadBuildMenu.add(getQueryResultsMenuItem()); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjLoadBuildMenu; }
private void createSelectAnotherMenu(int mode) { if (mode == EuclidianConstants.MODE_MOVE) { selectAnotherMenu = new JMenu(app.getMenu("SelectAnother")); } else { selectAnotherMenu = new JMenu(app.getMenu("PerformToolOn")); } selectAnotherMenu.setIcon(((AppD) app).getEmptyIcon()); selectAnotherMenu.setBackground(getWrappedPopup().getBackground()); selectAnotherMenu.setFont(((AppD) app).getItalicFont()); }
/* WARNING: THIS METHOD WILL BE REGENERATED. */ private javax.swing.JMenu getFile() { if (ivjFile == null) { try { ivjFile = new javax.swing.JMenu(); ivjFile.setName("File"); ivjFile.setText("File"); ivjFile.setBackground(java.awt.SystemColor.control); ivjFile.setActionCommand("FileMenu"); ivjFile.add(getExitMenuItem()); // user code begin {1} // user code end } catch (java.lang.Throwable ivjExc) { // user code begin {2} // user code end handleException(ivjExc); } } return ivjFile; }
/** Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.addWindowListener( new WindowAdapter() { @Override public void windowOpened(WindowEvent arg0) { // affichage de la boite de dialogue de chargement des données dialogLoadView dia = new dialogLoadView(frame, "Chargement des données", true); dia.setVisible(true); } }); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setSize(800, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout(0, 0)); panelEditView panelEditView_ = new panelEditView(); panelEditView_.getListResult().setBounds(37, 95, 364, 435); frame.getContentPane().add(panelEditView_, BorderLayout.CENTER); JMenuBar menuBar = new JMenuBar(); menuBar.setFont(new Font("Segoe UI", Font.PLAIN, 18)); menuBar.setBackground(Color.GRAY); frame.getContentPane().add(menuBar, BorderLayout.NORTH); JMenu menuFile = new JMenu("Fichier"); menuFile.setBackground(Color.GRAY); menuBar.add(menuFile); JMenuItem mntmNewMenuItem = new JMenuItem("Fermer"); mntmNewMenuItem.setBackground(Color.GRAY); menuFile.add(mntmNewMenuItem); // changement d'icon frame.setIconImage( new ImageIcon(MainApp.class.getResource("/images/logo-prevac-mini.png")).getImage()); // augmentation de la taille de la fenetre }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); mainPanel = new javax.swing.JPanel(); jDesktopPane1 = new javax.swing.JDesktopPane(); jPanel1 = new javax.swing.JPanel(); jDesktopPane2 = new javax.swing.JDesktopPane(); jLabel1 = new javax.swing.JLabel(); currentTaskNavOption = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); nextTaskNavOption = new javax.swing.JButton(); todayTaskNavOption = new javax.swing.JButton(); scheduleTaskNavOption = new javax.swing.JButton(); someDayTaskNavOption = new javax.swing.JButton(); logBookNavOption = new javax.swing.JButton(); trashCanNavOption = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); tasksTable = new javax.swing.JTable(); jDesktopPane3 = new javax.swing.JDesktopPane(); newTaskBtn = new javax.swing.JButton(); jButton9 = new javax.swing.JButton(); editRow = new javax.swing.JButton(); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); mainPanel.setName("mainPanel"); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(addictionmanager.AddictionManagerApp.class) .getContext() .getResourceMap(AddictionManagerView.class); jDesktopPane1.setBackground(resourceMap.getColor("jDesktopPane1.background")); // NOI18N jDesktopPane1.setName("jDesktopPane1"); // NOI18N jPanel1.setName("jPanel1"); // NOI18N org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(0, 160, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup( jPanel1Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(0, 100, Short.MAX_VALUE)); jPanel1.setBounds(10, 20, 160, 100); jDesktopPane1.add(jPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER); jDesktopPane2.setBackground(resourceMap.getColor("siderBarPanel.background")); // NOI18N jDesktopPane2.setName("siderBarPanel"); // NOI18N jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N jLabel1.setForeground(resourceMap.getColor("jLabel1.foreground")); // NOI18N jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N jLabel1.setName("jLabel1"); // NOI18N jLabel1.setBounds(10, 70, 50, 16); jDesktopPane2.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER); currentTaskNavOption.setIcon(resourceMap.getIcon("currentTaskNavOption.icon")); // NOI18N currentTaskNavOption.setText(resourceMap.getString("currentTaskNavOption.text")); // NOI18N currentTaskNavOption.setToolTipText( resourceMap.getString("currentTaskNavOption.toolTipText")); // NOI18N currentTaskNavOption.setName("currentTaskNavOption"); // NOI18N currentTaskNavOption.setSelected(true); currentTaskNavOption.setSelectedIcon( resourceMap.getIcon("currentTaskNavOption.selectedIcon")); // NOI18N currentTaskNavOption.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { currentTaskNavOptionActionPerformed(evt); } }); currentTaskNavOption.setBounds(0, 30, 180, 30); jDesktopPane2.add(currentTaskNavOption, javax.swing.JLayeredPane.DEFAULT_LAYER); jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N jLabel2.setForeground(resourceMap.getColor("jLabel2.foreground")); // NOI18N jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N jLabel2.setName("jLabel2"); // NOI18N jLabel2.setBounds(10, 10, 70, 15); jDesktopPane2.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER); nextTaskNavOption.setIcon(resourceMap.getIcon("nextActivityBtn.icon")); // NOI18N nextTaskNavOption.setText(resourceMap.getString("nextActivityBtn.text")); // NOI18N nextTaskNavOption.setToolTipText( resourceMap.getString("nextActivityBtn.toolTipText")); // NOI18N nextTaskNavOption.setName("nextActivityBtn"); // NOI18N nextTaskNavOption.setSelected(true); nextTaskNavOption.setSelectedIcon( resourceMap.getIcon("nextActivityBtn.selectedIcon")); // NOI18N nextTaskNavOption.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nextTaskNavOptionActionPerformed(evt); } }); nextTaskNavOption.setBounds(0, 120, 180, 30); jDesktopPane2.add(nextTaskNavOption, javax.swing.JLayeredPane.DEFAULT_LAYER); todayTaskNavOption.setIcon(resourceMap.getIcon("todayActivityBtn.icon")); // NOI18N todayTaskNavOption.setText(resourceMap.getString("todayActivityBtn.text")); // NOI18N todayTaskNavOption.setToolTipText( resourceMap.getString("todayActivityBtn.toolTipText")); // NOI18N todayTaskNavOption.setName("todayActivityBtn"); // NOI18N todayTaskNavOption.setSelected(true); todayTaskNavOption.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { todayTaskNavOptionActionPerformed(evt); } }); todayTaskNavOption.setBounds(0, 90, 180, 30); jDesktopPane2.add(todayTaskNavOption, javax.swing.JLayeredPane.DEFAULT_LAYER); scheduleTaskNavOption.setIcon(resourceMap.getIcon("scheduleActivityBtn.icon")); // NOI18N scheduleTaskNavOption.setText(resourceMap.getString("scheduleActivityBtn.text")); // NOI18N scheduleTaskNavOption.setToolTipText( resourceMap.getString("scheduleActivityBtn.toolTipText")); // NOI18N scheduleTaskNavOption.setName("scheduleActivityBtn"); // NOI18N scheduleTaskNavOption.setSelected(true); scheduleTaskNavOption.setSelectedIcon( resourceMap.getIcon("scheduleActivityBtn.selectedIcon")); // NOI18N scheduleTaskNavOption.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { scheduleTaskNavOptionActionPerformed(evt); } }); scheduleTaskNavOption.setBounds(0, 150, 180, 30); jDesktopPane2.add(scheduleTaskNavOption, javax.swing.JLayeredPane.DEFAULT_LAYER); someDayTaskNavOption.setIcon(resourceMap.getIcon("somedayActivityBtn.icon")); // NOI18N someDayTaskNavOption.setText(resourceMap.getString("somedayActivityBtn.text")); // NOI18N someDayTaskNavOption.setToolTipText( resourceMap.getString("somedayActivityBtn.toolTipText")); // NOI18N someDayTaskNavOption.setName("somedayActivityBtn"); // NOI18N someDayTaskNavOption.setSelected(true); someDayTaskNavOption.setSelectedIcon( resourceMap.getIcon("somedayActivityBtn.selectedIcon")); // NOI18N someDayTaskNavOption.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { someDayTaskNavOptionActionPerformed(evt); } }); someDayTaskNavOption.setBounds(0, 180, 180, 30); jDesktopPane2.add(someDayTaskNavOption, javax.swing.JLayeredPane.DEFAULT_LAYER); logBookNavOption.setIcon(resourceMap.getIcon("logbookBtn.icon")); // NOI18N logBookNavOption.setText(resourceMap.getString("logbookBtn.text")); // NOI18N logBookNavOption.setToolTipText(resourceMap.getString("logbookBtn.toolTipText")); // NOI18N logBookNavOption.setName("logbookBtn"); // NOI18N logBookNavOption.setSelected(true); logBookNavOption.setSelectedIcon(resourceMap.getIcon("logbookBtn.selectedIcon")); // NOI18N logBookNavOption.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { logBookNavOptionActionPerformed(evt); } }); logBookNavOption.setBounds(0, 560, 180, 30); jDesktopPane2.add(logBookNavOption, javax.swing.JLayeredPane.DEFAULT_LAYER); trashCanNavOption.setIcon(resourceMap.getIcon("trashBtn.icon")); // NOI18N trashCanNavOption.setText(resourceMap.getString("trashBtn.text")); // NOI18N trashCanNavOption.setToolTipText(resourceMap.getString("trashBtn.toolTipText")); // NOI18N trashCanNavOption.setName("trashBtn"); // NOI18N trashCanNavOption.setSelected(true); trashCanNavOption.setSelectedIcon(resourceMap.getIcon("trashBtn.selectedIcon")); // NOI18N trashCanNavOption.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { trashCanNavOptionActionPerformed(evt); } }); trashCanNavOption.setBounds(0, 590, 180, 30); jDesktopPane2.add(trashCanNavOption, javax.swing.JLayeredPane.DEFAULT_LAYER); jPanel2.setBackground(resourceMap.getColor("centerPanel.background")); // NOI18N jPanel2.setForeground(resourceMap.getColor("centerPanel.foreground")); // NOI18N jPanel2.setName("centerPanel"); // NOI18N jScrollPane1.setName("jScrollPane1"); // NOI18N tasksTable.setBackground(resourceMap.getColor("tasksTable.background")); // NOI18N tasksTable.setFont(resourceMap.getFont("tasksTable.font")); // NOI18N tasksTable.setForeground(resourceMap.getColor("tasksTable.foreground")); // NOI18N tasksTable.setModel( new javax.swing.table.DefaultTableModel( new Object[][] {}, new String[] { "", "Task no.", "Task Name", "Task Description", "Allowed Applications", "Restricted Applications", "Start Date & Time", "End Date & Time", "Notification Type" }) { Class[] types = new Class[] { java.lang.Boolean.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean[] {true, false, false, false, false, false, false, false, false}; public Class getColumnClass(int columnIndex) { return types[columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit[columnIndex]; } }); tasksTable.setColumnSelectionAllowed(true); tasksTable.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); tasksTable.setGridColor(resourceMap.getColor("tasksTable.gridColor")); // NOI18N tasksTable.setName("tasksTable"); // NOI18N tasksTable.setRowHeight(30); tasksTable.setRowMargin(3); tasksTable.setSelectionBackground( resourceMap.getColor("tasksTable.selectionBackground")); // NOI18N tasksTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); tasksTable.getTableHeader().setReorderingAllowed(false); jScrollPane1.setViewportView(tasksTable); tasksTable .getColumnModel() .getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); tasksTable.getColumnModel().getColumn(0).setMinWidth(15); tasksTable.getColumnModel().getColumn(0).setPreferredWidth(20); tasksTable.getColumnModel().getColumn(0).setMaxWidth(20); tasksTable .getColumnModel() .getColumn(0) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title6")); // NOI18N tasksTable.getColumnModel().getColumn(1).setMinWidth(40); tasksTable.getColumnModel().getColumn(1).setPreferredWidth(55); tasksTable.getColumnModel().getColumn(1).setMaxWidth(55); tasksTable .getColumnModel() .getColumn(1) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title0")); // NOI18N tasksTable.getColumnModel().getColumn(2).setMinWidth(80); tasksTable.getColumnModel().getColumn(2).setPreferredWidth(120); tasksTable.getColumnModel().getColumn(2).setMaxWidth(220); tasksTable .getColumnModel() .getColumn(2) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title1")); // NOI18N tasksTable.getColumnModel().getColumn(3).setMinWidth(150); tasksTable.getColumnModel().getColumn(3).setPreferredWidth(220); tasksTable.getColumnModel().getColumn(3).setMaxWidth(320); tasksTable .getColumnModel() .getColumn(3) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title9")); // NOI18N tasksTable.getColumnModel().getColumn(4).setMinWidth(80); tasksTable.getColumnModel().getColumn(4).setPreferredWidth(140); tasksTable.getColumnModel().getColumn(4).setMaxWidth(240); tasksTable .getColumnModel() .getColumn(4) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title2")); // NOI18N tasksTable.getColumnModel().getColumn(5).setMinWidth(120); tasksTable.getColumnModel().getColumn(5).setPreferredWidth(160); tasksTable.getColumnModel().getColumn(5).setMaxWidth(260); tasksTable .getColumnModel() .getColumn(5) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title3")); // NOI18N tasksTable.getColumnModel().getColumn(6).setMinWidth(80); tasksTable.getColumnModel().getColumn(6).setPreferredWidth(120); tasksTable.getColumnModel().getColumn(6).setMaxWidth(220); tasksTable .getColumnModel() .getColumn(6) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title4")); // NOI18N tasksTable.getColumnModel().getColumn(7).setMinWidth(80); tasksTable.getColumnModel().getColumn(7).setPreferredWidth(120); tasksTable.getColumnModel().getColumn(7).setMaxWidth(220); tasksTable .getColumnModel() .getColumn(7) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title7")); // NOI18N tasksTable.getColumnModel().getColumn(8).setMinWidth(80); tasksTable.getColumnModel().getColumn(8).setPreferredWidth(100); tasksTable.getColumnModel().getColumn(8).setMaxWidth(200); tasksTable .getColumnModel() .getColumn(8) .setHeaderValue(resourceMap.getString("tasksTable.columnModel.title8")); // NOI18N jDesktopPane3.setBackground(resourceMap.getColor("jDesktopPane3.background")); // NOI18N jDesktopPane3.setName("jDesktopPane3"); // NOI18N newTaskBtn.setText(resourceMap.getString("newTaskBtn.text")); // NOI18N newTaskBtn.setName("newTaskBtn"); // NOI18N newTaskBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newTaskBtnActionPerformed(evt); } }); newTaskBtn.setBounds(20, 10, 97, 29); jDesktopPane3.add(newTaskBtn, javax.swing.JLayeredPane.DEFAULT_LAYER); jButton9.setText(resourceMap.getString("jButton9.text")); // NOI18N jButton9.setEnabled(false); jButton9.setName("jButton9"); // NOI18N jButton9.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton9ActionPerformed(evt); } }); jButton9.setBounds(920, 10, 110, 29); jDesktopPane3.add(jButton9, javax.swing.JLayeredPane.DEFAULT_LAYER); editRow.setText(resourceMap.getString("editRow.text")); // NOI18N editRow.setEnabled(false); editRow.setName("editRow"); // NOI18N editRow.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editRowActionPerformed(evt); } }); editRow.setBounds(810, 10, 110, 29); jDesktopPane3.add(editRow, javax.swing.JLayeredPane.DEFAULT_LAYER); org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jDesktopPane3) .add( org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1030, Short.MAX_VALUE)); jPanel2Layout.setVerticalGroup( jPanel2Layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout .createSequentialGroup() .add( jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 591, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add( jDesktopPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 57, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))); org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add( mainPanelLayout .createSequentialGroup() .add( jDesktopPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add( jDesktopPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 180, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add( jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); mainPanelLayout.setVerticalGroup( mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jDesktopPane1) .add(org.jdesktop.layout.GroupLayout.TRAILING, jDesktopPane2) .add( jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); menuBar.setName("menuBar"); // NOI18N org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, menuBar, org.jdesktop.beansbinding.ELProperty.create("${background}"), menuBar, org.jdesktop.beansbinding.BeanProperty.create("background")); bindingGroup.addBinding(binding); fileMenu.setBackground(resourceMap.getColor("fileMenu.background")); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N jMenuItem1.setAccelerator( javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK)); jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N jMenuItem1.setName("jMenuItem1"); // NOI18N jMenuItem1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); fileMenu.add(jMenuItem1); jSeparator1.setName("jSeparator1"); // NOI18N fileMenu.add(jSeparator1); javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(addictionmanager.AddictionManagerApp.class) .getContext() .getActionMap(AddictionManagerView.class, this); exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N fileMenu.add(exitMenuItem); menuBar.add(fileMenu); helpMenu.setBackground(resourceMap.getColor("helpMenu.background")); // NOI18N helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N helpMenu.setName("helpMenu"); // NOI18N aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N aboutMenuItem.setIcon(resourceMap.getIcon("aboutMenuItem.icon")); // NOI18N aboutMenuItem.setName("aboutMenuItem"); // NOI18N helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setComponent(mainPanel); setMenuBar(menuBar); bindingGroup.bind(); } // </editor-fold>//GEN-END:initComponents
@Override public void setBackground(Color bg) { setOpaque(bg.getAlpha() == 255); super.setBackground(bg); }
/** * Creates new ZoomMenu * * @param app * @param px * @param py */ public ContextMenuGraphicsWindow(Application app, double px, double py) { this(app); iconZoom = app.getImageIcon("zoom16.gif"); // zoom point this.px = px; this.py = py; EuclidianViewInterfaceCommon ev = app.getActiveEuclidianView(); if (ev.getEuclidianViewNo() == 2) { setTitle("<html>" + app.getPlain("DrawingPad2") + "</html>"); } else { setTitle("<html>" + app.getPlain("DrawingPad") + "</html>"); } addAxesAndGridCheckBoxes(); addSeparator(); // zoom for both axes JMenu zoomMenu = new JMenu(app.getMenu("Zoom")); zoomMenu.setIcon(iconZoom); zoomMenu.setBackground(getBackground()); addZoomItems(zoomMenu); add(zoomMenu); // zoom for y-axis JMenu yaxisMenu = new JMenu(app.getPlain("xAxis") + " : " + app.getPlain("yAxis")); yaxisMenu.setIcon(app.getEmptyIcon()); yaxisMenu.setBackground(getBackground()); addAxesRatioItems(yaxisMenu); add(yaxisMenu); JMenuItem miShowAllObjectsView = new JMenuItem(app.getPlain("ShowAllObjects")); miShowAllObjectsView.setIcon(app.getEmptyIcon()); miShowAllObjectsView.setActionCommand("showAllObjects"); miShowAllObjectsView.addActionListener(this); miShowAllObjectsView.setBackground(bgColor); add(miShowAllObjectsView); JMenuItem miStandardView = new JMenuItem(app.getPlain("StandardView")); setMenuShortCutAccelerator(miStandardView, 'M'); miStandardView.setIcon(app.getEmptyIcon()); miStandardView.setActionCommand("standardView"); miStandardView.addActionListener(this); miStandardView.setBackground(bgColor); add(miStandardView); addSeparator(); if (!ev.isZoomable()) { zoomMenu.setEnabled(false); yaxisMenu.setEnabled(false); miShowAllObjectsView.setEnabled(false); miStandardView.setEnabled(false); } if (ev.isUnitAxesRatio()) { yaxisMenu.setEnabled(false); } addMiProperties(); }
BasicCalculatorFrame( String header, CalculatorModel model, OutputPanelDefault opDefault, OutputPanelYellow opYellow, OutputPanelFunky opFunky, ButtonPanelTop top, ButtonPanelMain main, Point location) { // call JFrame with string title of frame super(header); // Create a container to hold all of our control and view components Container cp = getContentPane(); // flow needs to be set before adding components (how will the frame's components be layed out?) FlowLayout layout = new FlowLayout(); // layout.setAlignment(FlowLayout.CENTER); // default // layout.setVgap(5); // default // layout.setHgap(5); // default cp.setLayout(layout); // set the layout cp.setBackground(backgroundColor); // set the backgroundcolor /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ * * Create and set Views. * *@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ // set the three output panels to the output panels passed in to constructor this.opDefault = opDefault; this.opYellow = opYellow; this.opFunky = opFunky; cp.add(opDefault); cp.add(opYellow); cp.add(opFunky); // Ensure any changes in the Model (the "subject") will be "Observed" // by the View (i.e., the "update()" method in the View will be triggered // when the model indicates a changed state) model.addObserver(opDefault); model.addObserver(opYellow); model.addObserver(opFunky); /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ * * Create and set Controllers. * *@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ // We set this class' controller pointers to those passed in to the constructor. // Our two complementary controllers must have references to the model. this.top = top; this.main = main; cp.add(top); // add these components to the JFrame cp.add(main); // add these components to the JFrame /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ * * Create Menu items. People just seem to be calmer if they see menu * items, so we will display them but they will do nothing. * *@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ jmb = new JMenuBar(); jmb.setBackground(backgroundColor); editMenu = new JMenu("Edit", true); editMenu.setBackground(backgroundColor); viewMenu = new JMenu("View", true); viewMenu.setBackground(backgroundColor); helpMenu = new JMenu("Help", true); helpMenu.setBackground(backgroundColor); notNecessaryMenu = new JMenu("Are Not Necessary", true); notNecessaryMenu.setBackground(backgroundColor); JRadioButtonMenuItem agree = new JRadioButtonMenuItem("I agree"); JRadioButtonMenuItem disagree = new JRadioButtonMenuItem("You're wrong! They help me sleep at night"); notNecessaryMenu.add(agree); notNecessaryMenu.add(disagree); jmb.add(editMenu); jmb.add(viewMenu); jmb.add(helpMenu); jmb.add(notNecessaryMenu); this.setJMenuBar(jmb); /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ * * Set JFrame window properties. * *@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */ this.setDefaultCloseOperation(EXIT_ON_CLOSE); // exit program when close button pressed this.setSize(400, 420); // set this JFrame's size big enough to hold all of its components this.setVisible(true); // show this JFrame this.setResizable(true); // you can resize this JFrame if you wish this.setLocation(location); }
/** *********************************************************************** */ private void initComponents() { /** ******************** The main container *************************** */ Container container = this.getContentPane(); container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS)); // container.setLayout( new PercentLayout() ); container.setBackground(Color.black); addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.out.println("Trace viewer closed!"); // System.exit(0); } }); /** ******************** Menu bar ************************************* */ menuBar = new JMenuBar(); setJMenuBar(menuBar); // Build a second menu in the menu bar. optionsMenu = new JMenu(" Options "); optionsMenu.setBorder(new BevelBorder(BevelBorder.RAISED)); optionsMenu.setToolTipText("Some options related to the GUI"); animationMenuItem = new JMenuItem(" Animation "); animationMenuItem.setToolTipText("Animation of the entire selected session"); animationMenuItem.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { listenerTracesViewer.animationActionPerformed(evt); } }); optionsMenu.add(animationMenuItem); menuBar.add(optionsMenu); // create a menu and add it to the menubar displayAllSessionsMenu = new JMenu(" Display Sessions "); displayAllSessionsMenu.setBorder(new BevelBorder(BevelBorder.RAISED)); displayAllSessionsMenu.setToolTipText( "Display all the retrieved sessions in a separate windows"); displayAllSessionsMenu.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { listenerTracesViewer.displayAllSessionsMouseEvent(evt); } }); // add the Controls menu to the menu bar menuBar.add(displayAllSessionsMenu); // create a menu and add it to the menubar refreshMenu = new JMenu(" Refresh "); refreshMenu.setBorder(new BevelBorder(BevelBorder.RAISED)); refreshMenu.setBackground(new Color(51, 153, 255)); refreshMenu.setToolTipText("Get the new traces"); refreshMenu.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { listenerTracesViewer.refreshActionPerformed(evt); } }); // add the Controls menu to the menu bar menuBar.add(refreshMenu); // ...create and add some menus... menuBar.add(Box.createHorizontalGlue()); helpMenu = new JMenu(" Help "); helpMenu.setBorder(new BevelBorder(BevelBorder.RAISED)); helpMenu.setToolTipText("Some useful notes about this tool"); helpMenu.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { listenerTracesViewer.helpMenuMouseEvent(evt); } }); menuBar.add(helpMenu); aboutMenu = new JMenu(" About "); aboutMenu.setBorder(new BevelBorder(BevelBorder.RAISED)); aboutMenu.setToolTipText("Some advertises about the creators!"); aboutMenu.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { listenerTracesViewer.aboutMenuMouseEvent(evt); } }); menuBar.add(aboutMenu); quitMenu = new JMenu(" Quit "); quitMenu.setBorder(new BevelBorder(BevelBorder.RAISED)); quitMenu.setToolTipText("Quit the traces viewer"); quitMenu.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { close(); } }); menuBar.add(quitMenu); /** ****************** FIRST PANEL ******************************* */ firstPanel = new JPanel(); // If put to False: we see the container's background firstPanel.setOpaque(false); firstPanel.setLayout(new PercentLayout()); // firstPanel.setLayout( new BorderLayout() ); container.add(firstPanel); // Sub right panel: // topx %, topy %, width %, height % 73, 100-> 65, 95 PercentLayoutConstraint firstPanelConstraint = new PercentLayoutConstraint(30, 0, 70, 100); tracesSessionsList = new TracesSessionsList(); tracesSessionsList.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { listenerTracesViewer.tracesSessionsListStateChanged(e); } }); tracesSessionsList.setForeground(Color.black); tracesSessionsList.setFont(new Font("Dialog", 1, 14)); ScrollPane scroll = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); TracesSession tracesSession = tracesSessions.firstElement(); String name = tracesSession.getName(); String logDescription = tracesSession.getLogDescription(); String callId = tracesSessionsList.getCallId(name); String origin = tracesSessionsList.getOrigin(name); // Warning: to put before for the canvas!!!! TextArea messageContentTextArea = new TextArea(); messageContentButton = new JButton("SIP Message:"); if (name.equals("No available session, refresh")) { tracesCanvas = new TracesCanvas(tracesSession, messageContentTextArea, "unknown", this); } else if (logDescription == null || logDescription.trim().equals("")) { tracesCanvas = new TracesCanvas(tracesSession, messageContentTextArea, origin, this); } else { // System.out.println("logDesc44:"+logDescription); tracesCanvas = new TracesCanvas(tracesSession, messageContentTextArea, logDescription, this); } tracesSessionsList.setTracesCanvas(tracesCanvas); // The ScrollPane for the Canvas scroll.add(tracesCanvas); firstPanel.add(scroll, firstPanelConstraint); /** ************************* SECOND PANEL ******************************* */ // left panel: secondPanel = new JPanel(); secondPanel.setBackground(Color.black); // rows, columns // secondPanel.setLayout(new GridLayout(3,1,0,0) ); secondPanel.setLayout(new BorderLayout()); // topx %, topy %, width %, height % PercentLayoutConstraint secondPanelConstraint = new PercentLayoutConstraint(0, 0, 30, 100); firstPanel.add(secondPanel, secondPanelConstraint); /** **************************** FIRST SUB PANEL ********************************* */ // Sub left panel: firstSubPanel = new JPanel(); firstSubPanel.setBackground(Color.black); // Top, left, bottom, right firstSubPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 7, 5)); if (!standaloneViewer) { // rows, columns, gap, gap firstSubPanel.setLayout(new GridLayout(2, 1, 3, 6)); secondPanel.add(firstSubPanel, BorderLayout.NORTH); JPanel panelGrid = new JPanel(); panelGrid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panelGrid.setLayout(new GridLayout(2, 1, 0, 0)); JPanel panelBox = new JPanel(); panelBox.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); panelBox.setLayout(new BorderLayout()); JLabel scriptLabel = new JLabel("Display the event script:"); scriptLabel.setToolTipText("Display the content of the selected script"); scriptLabel.setHorizontalAlignment(SwingConstants.CENTER); scriptLabel.setForeground(Color.black); scriptLabel.setFont(new Font("Dialog", 1, 14)); // If put to true: we see the label's background scriptLabel.setOpaque(true); panelGrid.add(scriptLabel); choice = new Choice(); panelBox.add(choice, BorderLayout.CENTER); scriptButton = new JButton("Open"); scriptButton.setToolTipText("Get the script controlling the current session"); scriptButton.setFont(new Font("Dialog", 1, 14)); scriptButton.setFocusPainted(false); scriptButton.setBackground(new Color(186, 175, 175)); scriptButton.setBorder(new BevelBorder(BevelBorder.RAISED)); scriptButton.setVerticalAlignment(SwingConstants.CENTER); scriptButton.setHorizontalAlignment(SwingConstants.CENTER); panelBox.add(scriptButton, BorderLayout.EAST); scriptButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { listenerTracesViewer.scriptActionPerformed(evt); } }); panelGrid.add(panelBox); firstSubPanel.add(panelGrid); // initComboBox(); /* refreshButton=new JButton("Refresh"); refreshButton.setToolTipText("Refresh all the sessions"); refreshButton.setFont(new Font ("Dialog", 1, 14)); refreshButton.setFocusPainted(false); //refreshButton.setBackground(new Color(186,175,175)); refreshButton.setBackground( new Color(51,153,255)); refreshButton.setBorder(new BevelBorder(BevelBorder.RAISED)); refreshButton.setVerticalAlignment(AbstractButton.CENTER); refreshButton.setHorizontalAlignment(AbstractButton.CENTER); firstSubPanel.add(refreshButton); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { listenerTracesViewer.refreshActionPerformed(evt); } } ); */ ImageIcon icon; if (logoNist != null) { icon = new ImageIcon(logoNist); JLabel label = new JLabel(icon); label.setVisible(true); label.setToolTipText("The NIST logo!!!"); // label.setHorizontalAlignment(AbstractButton.CENTER); label.setForeground(Color.black); // label.setFont(new Font ("Dialog", 1, 14)); label.setOpaque(false); firstSubPanel.add(label); } } else { // rows, columns, gap, gap firstSubPanel.setLayout(new GridLayout(1, 1, 3, 6)); secondPanel.add(firstSubPanel, BorderLayout.NORTH); ImageIcon icon; if (logoNist != null) { icon = new ImageIcon(logoNist); JLabel label = new JLabel(icon); label.setVisible(true); label.setToolTipText("The NIST logo!!!"); label.setHorizontalAlignment(SwingConstants.CENTER); label.setForeground(Color.black); label.setFont(new Font("Dialog", 1, 14)); label.setOpaque(false); firstSubPanel.add(label); } } /** **************** SECOND SUB PANEL *************************************** */ JPanel panel = new JPanel(); panel.setLayout(new GridLayout(2, 1, 0, 0)); secondPanel.add(panel, BorderLayout.CENTER); secondSubPanel = new JPanel(); secondSubPanel.setBackground(Color.black); secondSubPanel.setLayout(new BorderLayout()); // secondPanel.add(secondSubPanel); panel.add(secondSubPanel); sessionsLabel = new JLabel("Sessions available:"); sessionsLabel.setToolTipText("All the sessions currently available"); // Alignment of the text sessionsLabel.setHorizontalAlignment(SwingConstants.CENTER); // Color of the text sessionsLabel.setForeground(Color.black); // Size of the text sessionsLabel.setFont(new Font("Dialog", 1, 14)); // If put to true: we see the label's background sessionsLabel.setOpaque(true); sessionsLabel.setBackground(Color.lightGray); sessionsLabel.setBorder(BorderFactory.createLineBorder(Color.darkGray)); secondSubPanel.add(sessionsLabel, BorderLayout.NORTH); ScrollPane scrollList = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); scrollList.add(tracesSessionsList); // secondSubPanel.add(scrollList,BorderLayout.CENTER); secondSubPanel.add(tracesSessionsList, BorderLayout.CENTER); /** ****************** THIRD SUB PANEL *************************************** */ thirdSubPanel = new JPanel(); thirdSubPanel.setBackground(Color.black); thirdSubPanel.setLayout(new BorderLayout()); // secondPanel.add(thirdSubPanel); panel.add(thirdSubPanel); messageContentButton.setToolTipText("Display all the content of the current SIP message"); // Alignment of the text messageContentButton.setHorizontalAlignment(SwingConstants.CENTER); // Color of the text messageContentButton.setForeground(Color.black); // Size of the text messageContentButton.setFont(new Font("Dialog", 1, 14)); // If put to true: we see the label's background messageContentButton.setOpaque(true); messageContentButton.setBackground(Color.lightGray); messageContentButton.setBorder(BorderFactory.createLineBorder(Color.darkGray)); messageContentButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { listenerTracesViewer.debugActionPerformed(evt); } }); messageContentTextArea.setBackground(Color.white); messageContentTextArea.setEditable(false); messageContentTextArea.setFont(new Font("Dialog", 1, 12)); messageContentTextArea.setForeground(Color.black); thirdSubPanel.add(messageContentButton, BorderLayout.NORTH); thirdSubPanel.add(messageContentTextArea, BorderLayout.CENTER); validateTree(); }