List of usage examples for javax.swing WindowConstants EXIT_ON_CLOSE
int EXIT_ON_CLOSE
To view the source code for javax.swing WindowConstants EXIT_ON_CLOSE.
Click Source Link
From source file:javaresturentdesktopclient.BillingPage.java
/** * 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.//from w ww.j a v a2s. com */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel3 = new javax.swing.JLabel(); jButtonremove = new javax.swing.JButton(); jTextField3 = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTableMealOrder = new javax.swing.JTable(); jTextFieldMealno = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jButton4 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMaximumSize(new java.awt.Dimension(715, 560)); setMinimumSize(new java.awt.Dimension(715, 560)); addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { formKeyReleased(evt); } }); getContentPane().setLayout(null); jLabel3.setFont(new java.awt.Font("Viner Hand ITC", 1, 18)); // NOI18N jLabel3.setForeground(new java.awt.Color(153, 0, 0)); jLabel3.setText("FOOD ITEM NO :"); getContentPane().add(jLabel3); jLabel3.setBounds(130, 80, 160, 40); jButtonremove.setText("Remove"); jButtonremove.setToolTipText("Press this Button To Remove Row From Table"); jButtonremove.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonremoveActionPerformed(evt); } }); getContentPane().add(jButtonremove); jButtonremove.setBounds(580, 340, 100, 30); jTextField3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField3ActionPerformed(evt); } }); getContentPane().add(jTextField3); jTextField3.setBounds(280, 80, 90, 31); jLabel4.setFont(new java.awt.Font("Viner Hand ITC", 1, 18)); // NOI18N jLabel4.setForeground(new java.awt.Color(153, 0, 0)); jLabel4.setText("QUANTITY:"); getContentPane().add(jLabel4); jLabel4.setBounds(160, 120, 130, 40); jTextField4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField4ActionPerformed(evt); } }); getContentPane().add(jTextField4); jTextField4.setBounds(280, 120, 90, 30); jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BUTTON IMAGE/ADD.png"))); // NOI18N jButton1.setToolTipText("PLEASE CLICK HERE FOR ADD FOOD"); jButton1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); getContentPane().add(jButton1); jButton1.setBounds(400, 120, 60, 20); jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BUTTON IMAGE/ADD BILL/DONE.png"))); // NOI18N jButton2.setToolTipText("CLICK HERE FOR TOTAL"); jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); getContentPane().add(jButton2); jButton2.setBounds(310, 460, 60, 20); jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BUTTON IMAGE/left.png"))); // NOI18N jButton3.setToolTipText("please click for going home page"); jButton3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); getContentPane().add(jButton3); jButton3.setBounds(500, 70, 50, 50); jTableMealOrder.setModel(new javax.swing.table.DefaultTableModel(new Object[][] { }, new String[] { "Meal No", "Food No", "food Name", "Quantity", "Price" })); jScrollPane1.setViewportView(jTableMealOrder); if (jTableMealOrder.getColumnModel().getColumnCount() > 0) { jTableMealOrder.getColumnModel().getColumn(1).setResizable(false); jTableMealOrder.getColumnModel().getColumn(2).setResizable(false); } getContentPane().add(jScrollPane1); jScrollPane1.setBounds(20, 190, 452, 220); jTextFieldMealno.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextFieldMealnoActionPerformed(evt); } }); getContentPane().add(jTextFieldMealno); jTextFieldMealno.setBounds(580, 290, 100, 30); jLabel1.setFont(new java.awt.Font("Viner Hand ITC", 1, 18)); // NOI18N jLabel1.setForeground(new java.awt.Color(153, 0, 0)); jLabel1.setText("MEAL NO:"); getContentPane().add(jLabel1); jLabel1.setBounds(480, 290, 100, 30); jButton4.setText("print"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); getContentPane().add(jButton4); jButton4.setBounds(600, 450, 70, 30); jLabel2.setIcon( new javax.swing.ImageIcon(getClass().getResource("/BUTTON IMAGE/background-1024x808 - Copy.jpg"))); // NOI18N jLabel2.setMaximumSize(new java.awt.Dimension(715, 560)); jLabel2.setMinimumSize(new java.awt.Dimension(715, 560)); jLabel2.setPreferredSize(new java.awt.Dimension(715, 560)); getContentPane().add(jLabel2); jLabel2.setBounds(0, 0, 700, 530); pack(); }
From source file:erigo.filewatch.DisplayPlot.java
/** * Creates a new plot./*from w w w . j ava 2s .c om*/ * * @param chartTitleI Chart title * @param xaxisLabelI Label for x-axis * @param yaxisLabelI Label for y-axis * @param xDataI x-axis data * @param yDataI y-axis data * @param xLocI x-pos of lower left corner of the JFrame * @param yLocI y-pos of lower left corner of the JFrame */ public DisplayPlot(String chartTitleI, String xaxisLabelI, String yaxisLabelI, List<Double> xDataI, List<Double> yDataI, int xLocI, int yLocI) { super("FileWatch data"); chartTitle = chartTitleI; xaxisLabel = xaxisLabelI; yaxisLabel = yaxisLabelI; xData = xDataI; yData = yDataI; // Create dataset XYDataset dataset = createDataset(); // Create chart JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xaxisLabel, yaxisLabel, dataset, PlotOrientation.VERTICAL, false, // no legend true, false); // Don't have any lower or upper margin; I think this will set the ends of the data // right up against the lower and upper edges of the plot XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setLowerMargin(0.0); plot.getDomainAxis().setUpperMargin(0.0); // Create Panel ChartPanel panel = new ChartPanel(chart); setContentPane(panel); setSize(800, 400); // setLocationRelativeTo(null); // to place in center of screen; not good if there are multiple plots setLocation(xLocI, yLocI); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:components.TextFieldDemo.java
/** This method is called from within the constructor to * initialize the form./*from w w w .ja v a 2s . c o m*/ */ private void initComponents() { entry = new JTextField(); textArea = new JTextArea(); status = new JLabel(); jLabel1 = new JLabel(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("TextFieldDemo"); textArea.setColumns(20); textArea.setLineWrap(true); textArea.setRows(5); textArea.setWrapStyleWord(true); textArea.setEditable(false); jScrollPane1 = new JScrollPane(textArea); jLabel1.setText("Enter text to search:"); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); //Create a parallel group for the horizontal axis ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); //Create a sequential and a parallel groups SequentialGroup h1 = layout.createSequentialGroup(); ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING); //Add a container gap to the sequential group h1 h1.addContainerGap(); //Add a scroll pane and a label to the parallel group h2 h2.addComponent(jScrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE); h2.addComponent(status, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE); //Create a sequential group h3 SequentialGroup h3 = layout.createSequentialGroup(); h3.addComponent(jLabel1); h3.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); h3.addComponent(entry, GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE); //Add the group h3 to the group h2 h2.addGroup(h3); //Add the group h2 to the group h1 h1.addGroup(h2); h1.addContainerGap(); //Add the group h1 to the hGroup hGroup.addGroup(GroupLayout.Alignment.TRAILING, h1); //Create the horizontal group layout.setHorizontalGroup(hGroup); //Create a parallel group for the vertical axis ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); //Create a sequential group v1 SequentialGroup v1 = layout.createSequentialGroup(); //Add a container gap to the sequential group v1 v1.addContainerGap(); //Create a parallel group v2 ParallelGroup v2 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); v2.addComponent(jLabel1); v2.addComponent(entry, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); //Add the group v2 tp the group v1 v1.addGroup(v2); v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED); v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE); v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED); v1.addComponent(status); v1.addContainerGap(); //Add the group v1 to the group vGroup vGroup.addGroup(v1); //Create the vertical group layout.setVerticalGroup(vGroup); pack(); }
From source file:TextAreaDemo.java
private void initComponents() { jLabel1 = new JLabel("Try typing 'spectacular' or 'Swing'..."); textArea = new JTextArea(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); textArea.setColumns(20);/*from w w w . ja v a2s . co m*/ textArea.setLineWrap(true); textArea.setRows(5); textArea.setWrapStyleWord(true); jScrollPane1 = new JScrollPane(textArea); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); // Create a parallel group for the horizontal axis ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); // Create a sequential and a parallel groups SequentialGroup h1 = layout.createSequentialGroup(); ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING); // Add a scroll panel and a label to the parallel group h2 h2.addComponent(jScrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE); h2.addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE); // Add a container gap to the sequential group h1 h1.addContainerGap(); // Add the group h2 to the group h1 h1.addGroup(h2); h1.addContainerGap(); // Add the group h1 to hGroup hGroup.addGroup(Alignment.TRAILING, h1); // Create the horizontal group layout.setHorizontalGroup(hGroup); // Create a parallel group for the vertical axis ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); // Create a sequential group SequentialGroup v1 = layout.createSequentialGroup(); // Add a container gap to the sequential group v1 v1.addContainerGap(); // Add a label to the sequential group v1 v1.addComponent(jLabel1); v1.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); // Add scroll panel to the sequential group v1 v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE); v1.addContainerGap(); // Add the group v1 to vGroup vGroup.addGroup(v1); // Create the vertical group layout.setVerticalGroup(vGroup); pack(); }
From source file:gtu._work.ui.TextScanUI.java
private void initGUI() { try {/*from w ww .j av a2s . c om*/ BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent evt) { thisComponentResized(evt); } }); this.addWindowStateListener(new WindowStateListener() { public void windowStateChanged(WindowEvent evt) { System.out.println("this.windowStateChanged, event=" + evt); // TODO add your code for this.windowStateChanged } }); this.addWindowListener(new WindowAdapter() { public void windowIconified(WindowEvent evt) { System.out.println("this.windowIconified, event=" + evt); // TODO add your code for this.windowIconified } }); this.setTitle(TITLE); { jPanel1 = new JPanel(); getContentPane().add(jPanel1, BorderLayout.NORTH); GroupLayout jPanel1Layout = new GroupLayout((JComponent) jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1.setPreferredSize(new java.awt.Dimension(521, 89)); jPanel1.setBounds(0, 0, 521, 89); { jButton1 = new JButton(); jButton1.setText("File"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton1ActionPerformed(evt); } }); } { jButton2 = new JButton(); jButton2.setText("Clipboard"); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton2ActionPerformed(evt); } }); } { contentFilter = new JTextField(); contentFilter.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent paramDocumentEvent) { jTextField2filterAgain(); } public void removeUpdate(DocumentEvent paramDocumentEvent) { jTextField2filterAgain(); } public void changedUpdate(DocumentEvent paramDocumentEvent) { jTextField2filterAgain(); } }); } { fileFilter = new JTextField(); fileFilter.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent paramDocumentEvent) { jTextField1DocumentListener(paramDocumentEvent); } public void removeUpdate(DocumentEvent paramDocumentEvent) { jTextField1DocumentListener(paramDocumentEvent); } public void changedUpdate(DocumentEvent paramDocumentEvent) { jTextField1DocumentListener(paramDocumentEvent); } }); } { totalLabel = new JLabel(); } { matchLabel = new JLabel(); } { jLabel4 = new JLabel(); jLabel4.setText("Match : "); } { jLabel2 = new JLabel(); jLabel2.setText("Total : "); } { ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] { "All", "Match" }); contextFilter = new JComboBox(); contextFilter.setModel(jComboBox1Model); contextFilter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jTextField2filterAgain(); } }); } { ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] { "Regex", "find" }); fileChk = new JComboBox(); fileChk.setModel(jComboBox1Model); fileChk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileChkActionPerformed(evt); } }); } { jScrollPane2 = new JScrollPane(); { ListModel groupListModel = new DefaultComboBoxModel(); groupList = new JList(); jScrollPane2.setViewportView(groupList); groupList.setModel(groupListModel); groupList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { groupListKeyPressed(evt); } }); } } jPanel1Layout.setVerticalGroup(jPanel1Layout.createSequentialGroup().addContainerGap(16, 16) .addGroup(jPanel1Layout.createParallelGroup() .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jButton1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(fileFilter, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(fileChk, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup().addGroup(jPanel1Layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jButton2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(contentFilter, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(contextFilter, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(matchLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(totalLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE))) .addContainerGap(12, 12)); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createSequentialGroup().addContainerGap(12, 12) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(contextFilter, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE) .addComponent(fileChk, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(jLabel4, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(matchLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE) .addComponent(totalLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(contentFilter, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 266, GroupLayout.PREFERRED_SIZE) .addComponent(fileFilter, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 266, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(jButton1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE)) .addGap(19) .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE) .addContainerGap(16, 16)); } { jScrollPane1 = new JScrollPane(); getContentPane().add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(581, 235)); { ListModel jList1Model = new DefaultComboBoxModel(); matchList = new JList(); jScrollPane1.setViewportView(matchList); // matchList.setPreferredSize(new java.awt.Dimension(575, // 232));// ??? // ?? // XXX // TODO // IMPORT // !!!! matchList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { jList1MouseClicked(evt); } }); matchList.setModel(jList1Model); } } this.setSize(697, 440); } catch (Exception e) { e.printStackTrace(); } }
From source file:net.mitnet.tools.pdf.book.publisher.ui.gui.BookPublisherGUI2.java
/** * Initialise widgets.//from w ww .j a v a 2 s .c o m */ protected void initComponents() { // frame this.frame = new JFrame(); this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.frame.setTitle(FRAME_TITLE); // input dir panel inputDirLabel = new JLabel(); inputDirLabel.setText("Input Folder:"); inputDirField = new JTextField(); inputDirField.setColumns(FILE_TEXTFIELD_WIDTH); inputDirButton = new JButton(); inputDirButton.setText("Browse ..."); inputDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { inputDirButtonActionHandler(event); } }); JPanel inputDirPanel = new JPanel(); // inputDirPanel.setLayout( new BoxLayout( inputDirPanel, BoxLayout.X_AXIS ) ); inputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); inputDirPanel.add(inputDirLabel); inputDirPanel.add(inputDirField); inputDirPanel.add(inputDirButton); // output dir panel outputDirLabel = new JLabel(); outputDirLabel.setText("Output Folder:"); outputDirField = new JTextField(); outputDirField.setColumns(FILE_TEXTFIELD_WIDTH); outputDirButton = new JButton(); outputDirButton.setText("Browse ..."); outputDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { outputDirButtonActionHandler(event); } }); JPanel outputDirPanel = new JPanel(); // outputDirPanel.setLayout( new BoxLayout( outputDirPanel, BoxLayout.X_AXIS ) ); outputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); outputDirPanel.add(outputDirLabel); outputDirPanel.add(outputDirField); outputDirPanel.add(outputDirButton); // document control panel docControlPanel = new JPanel(); docControlPanel.setLayout(new BoxLayout(docControlPanel, BoxLayout.Y_AXIS)); docControlPanel.add(inputDirPanel); docControlPanel.add(outputDirPanel); // Border docControlPanelBorder = BorderFactory.createTitledBorder("Documents"); Border docControlPanelBorder = BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Documents"), BorderFactory.createEmptyBorder(5, 5, 5, 5)); docControlPanel.setBorder(docControlPanelBorder); // publish button publishButton = new JButton(); publishButton.setText("Publish"); publishButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { publishButtonActionHandler(event); } }); // status message label statusMessageLabel = new JLabel(); // String statusMessageText = "Press " + publishButton.getText() + " to start."; String statusMessageText = ""; statusMessageLabel.setText(statusMessageText); // statusMessageLabel.setVisible(false); // progress bar progressBar = new JProgressBar(); // exit button exitButton = new JButton(); exitButton.setText("Exit"); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { exitButtonActionHandler(event); } }); // build main panel JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(docControlPanel); // mainPanel.add(new Spacer()); mainPanel.add(publishButton); // mainPanel.add(new Spacer()); mainPanel.add(progressBar); // mainPanel.add(new Spacer()); mainPanel.add(statusMessageLabel); // mainPanel.add(new Spacer()); mainPanel.add(exitButton); // add main panel to frame this.frame.getContentPane().setLayout(new BoxLayout(this.frame.getContentPane(), BoxLayout.Y_AXIS)); this.frame.getContentPane().add(mainPanel); // this.frame.setSize(800,600); this.frame.pack(); }
From source file:historyView.HistoryJFrame.java
/** * 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./*from w ww.java 2 s.c o m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(66, 66, 66)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 524, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 376, Short.MAX_VALUE)); pack(); }
From source file:com.josescalia.tumblr.app.MainFrame.java
/** * 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./*from w ww . j av a2s .c o m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); mainPanel = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); lblDate = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); lblTime = new javax.swing.JLabel(); lblMark = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu3 = new javax.swing.JMenu(); mnTumblrImageViewer = new javax.swing.JMenuItem(); jMenu1 = new javax.swing.JMenu(); mnTumblrFavList = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); mnConfiguration = new javax.swing.JMenuItem(); mnHelp = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); mnExit = new javax.swing.JMenuItem(); jMenuItem1.setText("jMenuItem1"); jMenuItem2.setText("jMenuItem2"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setIconImage(new ImageIcon(getClass().getResource("/icons/tumblr.png")).getImage()); setPreferredSize(new java.awt.Dimension(1360, 700)); mainPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); mainPanelLayout.setVerticalGroup(mainPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 652, Short.MAX_VALUE)); jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lblDate.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentDate}"), lblDate, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); progressBar.setString(""); progressBar.setStringPainted(true); lblTime.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${currentTime}"), lblTime, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); lblMark.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N lblMark.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblMark.setToolTipText(""); binding = org.jdesktop.beansbinding.Bindings.createAutoBinding( org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${lblFooter}"), lblMark, org.jdesktop.beansbinding.BeanProperty.create("text")); bindingGroup.addBinding(binding); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblDate, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblTime, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 690, Short.MAX_VALUE) .addComponent(lblMark, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(1, 1, 1).addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(progressBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblMark, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3))); jMenu3.setText("Tumblr"); mnTumblrImageViewer.setText("Tumblr Image Viewer"); mnTumblrImageViewer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnTumblrImageViewerActionPerformed(evt); } }); jMenu3.add(mnTumblrImageViewer); jMenuBar1.add(jMenu3); jMenu1.setText("Favorite"); mnTumblrFavList.setText("Tumblr Rss Fav List"); mnTumblrFavList.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnTumblrFavListActionPerformed(evt); } }); jMenu1.add(mnTumblrFavList); jMenuBar1.add(jMenu1); jMenu2.setText("System"); mnConfiguration.setText("Configuration"); mnConfiguration.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnConfigurationActionPerformed(evt); } }); jMenu2.add(mnConfiguration); mnHelp.setText("Help"); mnHelp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnHelpActionPerformed(evt); } }); jMenu2.add(mnHelp); jMenu2.add(jSeparator1); mnExit.setText("Exit"); mnExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mnExitActionPerformed(evt); } }); jMenu2.add(mnExit); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGap(1, 1, 1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(1, 1, 1).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); bindingGroup.bind(); pack(); }
From source file:com.github.benchdoos.weblocopener.weblocOpener.gui.EditDialog.java
private void initGui(String pathToEditingFile) { setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/images/icon96.png"))); this.path = pathToEditingFile; setContentPane(contentPane);//from w ww .jav a 2 s . c o m getRootPane().setDefaultButton(buttonOK); buttonOK.addActionListener(e -> onOK()); buttonCancel.addActionListener(e -> onCancel()); // call onCancel() when cross is clicked setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { if (textField.getText().isEmpty()) { fillTextFieldWithClipboard(); } super.windowActivated(e); } @Override public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); createWeblocFileTextPane.setBackground(new Color(232, 232, 232)); initTextField(pathToEditingFile); pack(); /*setMinimumSize(getSize()); setPreferredSize(getSize());*/ setSize(DEFAULT_APPLICATION_WIDTH, 200); setResizable(false); //TODO fix setMaximumSize setLocation(FrameUtils.getFrameOnCenterLocationPoint(this)); }
From source file:TextFieldDemo.java
/** * This method is called from within the constructor to initialize the form. *//*w w w . j a v a2s . co m*/ private void initComponents() { entry = new JTextField(); textArea = new JTextArea(); status = new JLabel(); jLabel1 = new JLabel(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("TextFieldDemo"); textArea.setColumns(20); textArea.setLineWrap(true); textArea.setRows(5); textArea.setWrapStyleWord(true); textArea.setEditable(false); jScrollPane1 = new JScrollPane(textArea); jLabel1.setText("Enter text to search:"); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); // Create a parallel group for the horizontal axis ParallelGroup hGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); // Create a sequential and a parallel groups SequentialGroup h1 = layout.createSequentialGroup(); ParallelGroup h2 = layout.createParallelGroup(GroupLayout.Alignment.TRAILING); // Add a container gap to the sequential group h1 h1.addContainerGap(); // Add a scroll pane and a label to the parallel group h2 h2.addComponent(jScrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE); h2.addComponent(status, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE); // Create a sequential group h3 SequentialGroup h3 = layout.createSequentialGroup(); h3.addComponent(jLabel1); h3.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); h3.addComponent(entry, GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE); // Add the group h3 to the group h2 h2.addGroup(h3); // Add the group h2 to the group h1 h1.addGroup(h2); h1.addContainerGap(); // Add the group h1 to the hGroup hGroup.addGroup(GroupLayout.Alignment.TRAILING, h1); // Create the horizontal group layout.setHorizontalGroup(hGroup); // Create a parallel group for the vertical axis ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); // Create a sequential group v1 SequentialGroup v1 = layout.createSequentialGroup(); // Add a container gap to the sequential group v1 v1.addContainerGap(); // Create a parallel group v2 ParallelGroup v2 = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); v2.addComponent(jLabel1); v2.addComponent(entry, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); // Add the group v2 tp the group v1 v1.addGroup(v2); v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED); v1.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE); v1.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED); v1.addComponent(status); v1.addContainerGap(); // Add the group v1 to the group vGroup vGroup.addGroup(v1); // Create the vertical group layout.setVerticalGroup(vGroup); pack(); }