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:de.xplib.xdbm.ui.Application.java
/** * //from w w w.j a v a 2 s . c o m */ private void initListener() { this.addWindowListener(new WindowAdapter() { public void windowClosing(final WindowEvent we) { config.save(); if (xmldb != null) { try { xmldb.getCollection("/db", "sa", "").close(); } catch (XMLDBException e) { e.printStackTrace(); } } } }); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.jspContentConsole.addComponentListener(new ComponentAdapter() { public void componentResized(final ComponentEvent ce) { jspContentConsole.setDividerLocation(jspContentConsole.getHeight() - 150); } }); }
From source file:net.openbyte.gui.WorkFrame.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Gary Lee menuBar1 = new JMenuBar(); menu2 = new JMenu(); menuItem8 = new JMenuItem(); menuItem6 = new JMenuItem(); menuItem4 = new JMenuItem(); menuItem5 = new JMenuItem(); menu3 = new JMenu(); menuItem7 = new JMenuItem(); menu6 = new JMenu(); menuItem11 = new JMenuItem(); menu1 = new JMenu(); menuItem1 = new JMenuItem(); menuItem2 = new JMenuItem(); menuItem3 = new JMenuItem(); menu4 = new JMenu(); menuItem9 = new JMenuItem(); menu5 = new JMenu(); menuItem10 = new JMenuItem(); scrollPane3 = new JScrollPane(); tree1 = new JTree(); rTextScrollPane1 = new RTextScrollPane(); rSyntaxTextArea1 = new RSyntaxTextArea(); //======== this ======== setTitle("Project Workspace"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS)); //======== menuBar1 ======== {// w ww . jav a 2s .c o m //======== menu2 ======== { menu2.setText("File"); //---- menuItem8 ---- menuItem8.setText("Add Class"); menuItem8.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem8ActionPerformed(e); } }); menu2.add(menuItem8); //---- menuItem6 ---- menuItem6.setText("Add Package"); menuItem6.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem6ActionPerformed(e); } }); menu2.add(menuItem6); //---- menuItem4 ---- menuItem4.setText("Save"); menuItem4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem4ActionPerformed(e); } }); menu2.add(menuItem4); //---- menuItem5 ---- menuItem5.setText("Close Project"); menuItem5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem5ActionPerformed(e); } }); menu2.add(menuItem5); } menuBar1.add(menu2); //======== menu3 ======== { menu3.setText("Edit"); //---- menuItem7 ---- menuItem7.setText("Delete"); menuItem7.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem7ActionPerformed(e); } }); menu3.add(menuItem7); } menuBar1.add(menu3); //======== menu6 ======== { menu6.setText("View"); //---- menuItem11 ---- menuItem11.setText("Output"); menuItem11.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem11ActionPerformed(e); } }); menu6.add(menuItem11); } menuBar1.add(menu6); //======== menu1 ======== { menu1.setText("Gradle"); //---- menuItem1 ---- menuItem1.setText("Run Client"); menuItem1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem1ActionPerformed(e); } }); menu1.add(menuItem1); //---- menuItem2 ---- menuItem2.setText("Run Server"); menuItem2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem2ActionPerformed(e); } }); menu1.add(menuItem2); //---- menuItem3 ---- menuItem3.setText("Build Mod JAR"); menuItem3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem3ActionPerformed(e); } }); menu1.add(menuItem3); } menuBar1.add(menu1); //======== menu4 ======== { menu4.setText("Git"); //---- menuItem9 ---- menuItem9.setText("Import into Git"); menuItem9.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem9ActionPerformed(e); menuItem9ActionPerformed(e); } }); menu4.add(menuItem9); //======== menu5 ======== { menu5.setText("Options"); menu5.setEnabled(false); //---- menuItem10 ---- menuItem10.setText("Commit"); menuItem10.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { menuItem10ActionPerformed(e); } }); menu5.add(menuItem10); } menu4.add(menu5); } menuBar1.add(menu4); } setJMenuBar(menuBar1); //======== scrollPane3 ======== { scrollPane3.setBorder(null); //---- tree1 ---- tree1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "File Manager")); tree1.setBackground(new Color(240, 240, 240)); tree1.setPreferredSize(new Dimension(-600, 85)); tree1.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { tree1ValueChanged(e); } }); scrollPane3.setViewportView(tree1); } contentPane.add(scrollPane3); //======== rTextScrollPane1 ======== { rTextScrollPane1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Code Editor")); //---- rSyntaxTextArea1 ---- rSyntaxTextArea1.setSyntaxEditingStyle("text/java"); rSyntaxTextArea1.setBackground(Color.white); rTextScrollPane1.setViewportView(rSyntaxTextArea1); } contentPane.add(rTextScrollPane1); setSize(1230, 785); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:me.mayo.telnetkek.MainPanel.java
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { splitPane = new javax.swing.JSplitPane(); jPanel3 = new javax.swing.JPanel(); mainOutputScoll = new javax.swing.JScrollPane(); mainOutput = new javax.swing.JTextPane(); btnDisconnect = new javax.swing.JButton(); btnSend = new javax.swing.JButton(); txtServer = new javax.swing.JComboBox<>(); chkAutoScroll = new javax.swing.JCheckBox(); txtCommand = new javax.swing.JTextField(); btnConnect = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel2 = new javax.swing.JPanel(); tblPlayersScroll = new javax.swing.JScrollPane(); tblPlayers = new javax.swing.JTable(); jLabel3 = new javax.swing.JLabel(); txtNumPlayers = new javax.swing.JTextField(); jPanel1 = new javax.swing.JPanel(); chkIgnorePlayerCommands = new javax.swing.JCheckBox(); chkIgnoreServerCommands = new javax.swing.JCheckBox(); chkShowChatOnly = new javax.swing.JCheckBox(); chkIgnoreErrors = new javax.swing.JCheckBox(); jPanel4 = new javax.swing.JPanel(); favoriteButtonsPanelHolder = new javax.swing.JPanel(); favoriteButtonsPanelScroll = new javax.swing.JScrollPane(); favoriteButtonsPanel = new me.mayo.telnetkek.button.FavoriteButtonsPanel(favButtonList); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("BukkitTelnetClient"); splitPane.setBackground(new java.awt.Color(68, 68, 68)); splitPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(68, 68, 68), 5)); splitPane.setResizeWeight(1.0);/*from ww w. j a v a2 s .co m*/ jPanel3.setBackground(new java.awt.Color(68, 68, 68)); mainOutput.setEditable(false); mainOutput.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N mainOutput.setForeground(new java.awt.Color(255, 255, 255)); mainOutputScoll.setViewportView(mainOutput); btnDisconnect.setBackground(new java.awt.Color(68, 68, 68)); btnDisconnect.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N btnDisconnect.setText("Leave"); btnDisconnect.setEnabled(false); btnDisconnect.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnDisconnectActionPerformed(evt); } }); btnSend.setBackground(new java.awt.Color(68, 68, 68)); btnSend.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N btnSend.setText("Send"); btnSend.setEnabled(false); btnSend.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSendActionPerformed(evt); } }); txtServer.setBackground(new java.awt.Color(91, 91, 91)); txtServer.setEditable(true); txtServer.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N txtServer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtServerActionPerformed(evt); } }); chkAutoScroll.setBackground(new java.awt.Color(68, 68, 68)); chkAutoScroll.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N chkAutoScroll.setForeground(new java.awt.Color(255, 255, 255)); chkAutoScroll.setSelected(true); chkAutoScroll.setText("Auto Scroll"); txtCommand.setEnabled(false); txtCommand.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txtCommandKeyPressed(evt); } }); btnConnect.setBackground(new java.awt.Color(68, 68, 68)); btnConnect.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N btnConnect.setText("Join"); btnConnect.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnConnectActionPerformed(evt); } }); jLabel1.setBackground(new java.awt.Color(68, 68, 68)); jLabel1.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Command:"); jLabel2.setBackground(new java.awt.Color(68, 68, 68)); jLabel2.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Server:"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(mainOutputScoll) .addGroup(jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1)).addGap(18, 18, 18) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtCommand) .addComponent(txtServer, 0, 411, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnConnect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnSend, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnDisconnect).addComponent(chkAutoScroll)))) .addContainerGap())); jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] { btnConnect, btnDisconnect, btnSend, chkAutoScroll }); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap() .addComponent(mainOutputScoll, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCommand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1).addComponent(btnSend).addComponent(chkAutoScroll)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(btnConnect).addComponent(btnDisconnect) .addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); splitPane.setLeftComponent(jPanel3); jTabbedPane1.setBackground(new java.awt.Color(68, 68, 68)); jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); jTabbedPane1.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N jPanel2.setBackground(new java.awt.Color(68, 68, 68)); tblPlayers.setAutoCreateRowSorter(true); tblPlayers.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N tblPlayers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); tblPlayersScroll.setViewportView(tblPlayers); tblPlayers.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jLabel3.setBackground(new java.awt.Color(68, 68, 68)); jLabel3.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Number of Players:"); txtNumPlayers.setEditable(false); txtNumPlayers.setBackground(new java.awt.Color(255, 255, 255)); txtNumPlayers.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tblPlayersScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup().addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txtNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0))) .addContainerGap())); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(tblPlayersScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3).addComponent(txtNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jTabbedPane1.addTab("Player List", jPanel2); jPanel1.setBackground(new java.awt.Color(68, 68, 68)); jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(68, 68, 68))); chkIgnorePlayerCommands.setBackground(new java.awt.Color(68, 68, 68)); chkIgnorePlayerCommands.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N chkIgnorePlayerCommands.setForeground(new java.awt.Color(255, 255, 255)); chkIgnorePlayerCommands.setSelected(true); chkIgnorePlayerCommands.setText("Ignore \"[PLAYER_COMMAND]\" messages"); chkIgnoreServerCommands.setBackground(new java.awt.Color(68, 68, 68)); chkIgnoreServerCommands.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N chkIgnoreServerCommands.setForeground(new java.awt.Color(255, 255, 255)); chkIgnoreServerCommands.setSelected(true); chkIgnoreServerCommands.setText("Ignore \"issued server command\" messages"); chkIgnoreServerCommands.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chkIgnoreServerCommandsActionPerformed(evt); } }); chkShowChatOnly.setBackground(new java.awt.Color(68, 68, 68)); chkShowChatOnly.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N chkShowChatOnly.setForeground(new java.awt.Color(255, 255, 255)); chkShowChatOnly.setText("Show chat only"); chkShowChatOnly.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chkShowChatOnlyActionPerformed(evt); } }); chkIgnoreErrors.setBackground(new java.awt.Color(68, 68, 68)); chkIgnoreErrors.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N chkIgnoreErrors.setForeground(new java.awt.Color(255, 255, 255)); chkIgnoreErrors.setText("Ignore warnings and errors"); chkIgnoreErrors.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chkIgnoreErrorsActionPerformed(evt); } }); 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() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(chkIgnorePlayerCommands).addComponent(chkIgnoreServerCommands) .addComponent(chkShowChatOnly).addComponent(chkIgnoreErrors)) .addContainerGap(68, Short.MAX_VALUE))); jPanel1Layout .setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(chkIgnorePlayerCommands, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkIgnoreServerCommands, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkShowChatOnly, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkIgnoreErrors, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(307, Short.MAX_VALUE))); jTabbedPane1.addTab("Filters", jPanel1); jPanel4.setBackground(new java.awt.Color(68, 68, 68)); jPanel4.setFont(new java.awt.Font("Lucida Sans Unicode", 0, 12)); // NOI18N favoriteButtonsPanelHolder.setLayout(new java.awt.BorderLayout()); favoriteButtonsPanelScroll.setBorder(null); favoriteButtonsPanel.setBackground(new java.awt.Color(68, 68, 68)); favoriteButtonsPanel.setLayout(null); favoriteButtonsPanelScroll.setViewportView(favoriteButtonsPanel); favoriteButtonsPanelHolder.add(favoriteButtonsPanelScroll, java.awt.BorderLayout.CENTER); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout .setHorizontalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout .createSequentialGroup().addGap(0, 0, 0).addComponent(favoriteButtonsPanelHolder, javax.swing.GroupLayout.DEFAULT_SIZE, 349, Short.MAX_VALUE) .addGap(0, 0, 0))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addComponent(favoriteButtonsPanelHolder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jTabbedPane1.addTab("Commands", jPanel4); splitPane.setRightComponent(jTabbedPane1); 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(0, 0, 0).addComponent(splitPane).addGap(0, 0, 0))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(splitPane, javax.swing.GroupLayout.Alignment.TRAILING)); pack(); }
From source file:com.heliosdecompiler.bootstrapper.Bootstrapper.java
private static HeliosData loadHelios() throws IOException { System.out.println("Finding Helios implementation"); HeliosData data = new HeliosData(); boolean needsToDownload = !IMPL_FILE.exists(); if (!needsToDownload) { try (JarFile jarFile = new JarFile(IMPL_FILE)) { ZipEntry entry = jarFile.getEntry("META-INF/MANIFEST.MF"); if (entry == null) { needsToDownload = true;// w w w . j a v a 2 s . c o m } else { Manifest manifest = new Manifest(jarFile.getInputStream(entry)); String ver = manifest.getMainAttributes().getValue("Implementation-Version"); try { data.buildNumber = Integer.parseInt(ver); data.version = manifest.getMainAttributes().getValue("Version"); data.mainClass = manifest.getMainAttributes().getValue("Main-Class"); } catch (NumberFormatException e) { needsToDownload = true; } } } catch (IOException e) { needsToDownload = true; } } if (needsToDownload) { URL latestJar = new URL(LATEST_JAR); System.out.println("Downloading latest Helios implementation"); FileOutputStream out = new FileOutputStream(IMPL_FILE); HttpURLConnection connection = (HttpURLConnection) latestJar.openConnection(); if (connection.getResponseCode() == 200) { int contentLength = connection.getContentLength(); if (contentLength > 0) { InputStream stream = connection.getInputStream(); byte[] buffer = new byte[1024]; int amnt; AtomicInteger total = new AtomicInteger(); AtomicBoolean stop = new AtomicBoolean(false); Thread progressBar = new Thread() { public void run() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); JLabel label = new JLabel(); label.setText("Downloading latest Helios build"); panel.add(label); GridLayout layout = new GridLayout(); layout.setColumns(1); layout.setRows(3); panel.setLayout(layout); JProgressBar pbar = new JProgressBar(); pbar.setMinimum(0); pbar.setMaximum(100); panel.add(pbar); JTextArea textArea = new JTextArea(1, 3); textArea.setOpaque(false); textArea.setEditable(false); textArea.setText("Downloaded 00.00MB/00.00MB"); panel.add(textArea); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setContentPane(panel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); while (!stop.get()) { SwingUtilities.invokeLater( () -> pbar.setValue((int) (100.0 * total.get() / contentLength))); textArea.setText("Downloaded " + bytesToMeg(total.get()) + "MB/" + bytesToMeg(contentLength) + "MB"); try { Thread.sleep(100); } catch (InterruptedException ignored) { } } frame.dispose(); } }; progressBar.start(); while ((amnt = stream.read(buffer)) != -1) { out.write(buffer, 0, amnt); total.addAndGet(amnt); } stop.set(true); return loadHelios(); } else { throw new IOException("Content-Length set to " + connection.getContentLength()); } } else if (connection.getResponseCode() == 404) { // Most likely bootstrapper is out of date throw new RuntimeException("Bootstrapper out of date!"); } else { throw new IOException(connection.getResponseCode() + ": " + connection.getResponseMessage()); } } return data; }
From source file:com.headswilllol.basiclauncher.Launcher.java
private static void createAndShowGUI() { f = new JFrame("Launcher"); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Launcher l = new Launcher(); l.setOpaque(true);/*from ww w.j a v a 2 s . c o m*/ f.setContentPane(l); f.pack(); f.setVisible(true); f.setSize(width, height); f.setResizable(false); f.setLocationRelativeTo(null); try { f.setIconImage(ImageIO.read(Launcher.class.getResourceAsStream("/images/icon.png"))); } catch (Exception ex) { } }
From source file:it.isislab.dmason.util.SystemManagement.Master.thrower.DMasonMaster.java
public DMasonMaster() { // Get the path from which MasterUI was started String path;//from w w w.ja va 2s . com try { path = URLDecoder.decode( DMasonWorkerWithGui.class.getProtectionDomain().getCodeSource().getLocation().getFile(), "UTF-8"); logger.debug("Path: " + path); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); logger.error("Unable to retrieve current working directory"); path = null; } enableReset = true; // disabled for debug /*if(path.contains(".jar")) //from jar enableReset = true; else enableReset = false; */ initComponents(); setSystemSettingsEnabled(false); config = new HashMap<String, EntryVal<Integer, Boolean>>(); setTitle("JMasterUI"); initializeDefaultLabel(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setResizable(false); starter = new Start(); curWorkerDigest = getCurWorkerDigest(); // Don't check workers' version on autoconnect (intended for easymode) if (curWorkerDigest == null && !autoconnect) loadUpdateFile(); if (rmiIp != null) { csManager = new ActiveMQManager(rmiIp, 61617); //"172.16.15.127" checkCommunicationServerStatus(); textFieldAddress.setText(rmiIp); if (!csManager.isUnknow()) setEnableActiveMQControl(true); } else { setEnableActiveMQControl(false); // lblStatusIcon.setIcon(new ImageIcon("it.isislab.dmason/resources/image/status-unknow.png"))); lblStatusIcon.setIcon(new ImageIcon("resources/image/status-unknow.png")); } }
From source file:com.igormaznitsa.zxpoly.MainForm.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./* w w w .j a va 2s. co m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; scrollPanel = new javax.swing.JScrollPane(); jSeparator2 = new javax.swing.JSeparator(); panelIndicators = new javax.swing.JPanel(); filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)); labelTurbo = new javax.swing.JLabel(); labelMouseUsage = new javax.swing.JLabel(); labelZX128 = new javax.swing.JLabel(); labelTapeUsage = new javax.swing.JLabel(); labelDiskUsage = new javax.swing.JLabel(); menuBar = new javax.swing.JMenuBar(); menuFile = new javax.swing.JMenu(); menuFileLoadSnapshot = new javax.swing.JMenuItem(); menuFileLoadTap = new javax.swing.JMenuItem(); menuLoadDrive = new javax.swing.JMenu(); menuFileSelectDiskA = new javax.swing.JMenuItem(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); jMenuItem3 = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); menuFileOptions = new javax.swing.JMenuItem(); jSeparator3 = new javax.swing.JPopupMenu.Separator(); menuFileExit = new javax.swing.JMenuItem(); menuTap = new javax.swing.JMenu(); menuTapeRewindToStart = new javax.swing.JMenuItem(); menuTapPrevBlock = new javax.swing.JMenuItem(); menuTapPlay = new javax.swing.JCheckBoxMenuItem(); menuTapNextBlock = new javax.swing.JMenuItem(); menuTapGotoBlock = new javax.swing.JMenuItem(); menuService = new javax.swing.JMenu(); menuFileReset = new javax.swing.JMenuItem(); menuResetKeyboard = new javax.swing.JMenuItem(); menuServiceSaveScreen = new javax.swing.JMenuItem(); menuTapExportAs = new javax.swing.JMenu(); menuTapExportAsWav = new javax.swing.JMenuItem(); menuTracer = new javax.swing.JMenu(); menuTraceCPU0 = new javax.swing.JCheckBoxMenuItem(); menuTraceCPU1 = new javax.swing.JCheckBoxMenuItem(); menuTraceCPU2 = new javax.swing.JCheckBoxMenuItem(); menuTraceCPU3 = new javax.swing.JCheckBoxMenuItem(); menuOptions = new javax.swing.JMenu(); menuOptionsShowIndicators = new javax.swing.JCheckBoxMenuItem(); menuOptionsZX128Mode = new javax.swing.JCheckBoxMenuItem(); menuOptionsTurbo = new javax.swing.JCheckBoxMenuItem(); menuHelp = new javax.swing.JMenu(); menuHelpAbout = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setLocationByPlatform(true); addWindowFocusListener(new java.awt.event.WindowFocusListener() { public void windowGainedFocus(java.awt.event.WindowEvent evt) { formWindowGainedFocus(evt); } public void windowLostFocus(java.awt.event.WindowEvent evt) { formWindowLostFocus(evt); } }); scrollPanel.setViewportView(jSeparator2); getContentPane().add(scrollPanel, java.awt.BorderLayout.CENTER); panelIndicators.setBorder(javax.swing.BorderFactory.createEtchedBorder()); panelIndicators.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1000.0; panelIndicators.add(filler1, gridBagConstraints); labelTurbo.setText(" "); labelTurbo.setToolTipText("Shows turbo mode on"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 0; panelIndicators.add(labelTurbo, gridBagConstraints); labelMouseUsage.setText(" "); labelMouseUsage.setToolTipText("Indicates kempston mouse activation, ESC - deactivate mouse"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 0; panelIndicators.add(labelMouseUsage, gridBagConstraints); labelZX128.setText(" "); labelZX128.setToolTipText("Shows that active ZX128 emulation mode"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 0; panelIndicators.add(labelZX128, gridBagConstraints); labelTapeUsage.setText(" "); labelTapeUsage.setToolTipText("Shows tape activity"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 8; gridBagConstraints.gridy = 0; panelIndicators.add(labelTapeUsage, gridBagConstraints); labelDiskUsage.setText(" "); labelDiskUsage.setToolTipText("Shows disk activity"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 9; gridBagConstraints.gridy = 0; panelIndicators.add(labelDiskUsage, gridBagConstraints); getContentPane().add(panelIndicators, java.awt.BorderLayout.SOUTH); menuFile.setText("File"); menuFileLoadSnapshot.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/snapshot.png"))); // NOI18N menuFileLoadSnapshot.setText("Load Snapshot"); menuFileLoadSnapshot.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileLoadSnapshotActionPerformed(evt); } }); menuFile.add(menuFileLoadSnapshot); menuFileLoadTap.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/cassette.png"))); // NOI18N menuFileLoadTap.setText("Load TAPE"); menuFileLoadTap.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileLoadTapActionPerformed(evt); } }); menuFile.add(menuFileLoadTap); menuLoadDrive.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/disk.png"))); // NOI18N menuLoadDrive.setText("Load Disk.."); menuFileSelectDiskA.setText("Drive A"); menuFileSelectDiskA.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileSelectDiskAActionPerformed(evt); } }); menuLoadDrive.add(menuFileSelectDiskA); jMenuItem1.setText("Drive B"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); menuLoadDrive.add(jMenuItem1); jMenuItem2.setText("Drive C"); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); menuLoadDrive.add(jMenuItem2); jMenuItem3.setText("Drive D"); jMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem3ActionPerformed(evt); } }); menuLoadDrive.add(jMenuItem3); menuFile.add(menuLoadDrive); menuFile.add(jSeparator1); menuFileOptions.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/settings.png"))); // NOI18N menuFileOptions.setText("Options"); menuFileOptions.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileOptionsActionPerformed(evt); } }); menuFile.add(menuFileOptions); menuFile.add(jSeparator3); menuFileExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK)); menuFileExit.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/reset.png"))); // NOI18N menuFileExit.setText("Exit"); menuFileExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileExitActionPerformed(evt); } }); menuFile.add(menuFileExit); menuBar.add(menuFile); menuTap.setText("Tape"); menuTapeRewindToStart.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_previous.png"))); // NOI18N menuTapeRewindToStart.setText("Rewind to start"); menuTapeRewindToStart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTapeRewindToStartActionPerformed(evt); } }); menuTap.add(menuTapeRewindToStart); menuTapPrevBlock.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_backward.png"))); // NOI18N menuTapPrevBlock.setText("Prev block"); menuTapPrevBlock.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTapPrevBlockActionPerformed(evt); } }); menuTap.add(menuTapPrevBlock); menuTapPlay.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, 0)); menuTapPlay.setText("Play"); menuTapPlay.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_play.png"))); // NOI18N menuTapPlay.setInheritsPopupMenu(true); menuTapPlay.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTapPlayActionPerformed(evt); } }); menuTap.add(menuTapPlay); menuTapNextBlock.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_forward.png"))); // NOI18N menuTapNextBlock.setText("Next block"); menuTapNextBlock.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTapNextBlockActionPerformed(evt); } }); menuTap.add(menuTapNextBlock); menuTapGotoBlock.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_pos.png"))); // NOI18N menuTapGotoBlock.setText("Go to block"); menuTapGotoBlock.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTapGotoBlockActionPerformed(evt); } }); menuTap.add(menuTapGotoBlock); menuBar.add(menuTap); menuService.setText("Service"); menuFileReset.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F12, 0)); menuFileReset.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/reset2.png"))); // NOI18N menuFileReset.setText("Reset"); menuFileReset.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuFileResetActionPerformed(evt); } }); menuService.add(menuFileReset); menuResetKeyboard.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/keyboard.png"))); // NOI18N menuResetKeyboard.setText("Reset keyboard"); menuResetKeyboard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuResetKeyboardActionPerformed(evt); } }); menuService.add(menuResetKeyboard); menuServiceSaveScreen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F8, 0)); menuServiceSaveScreen.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/photo.png"))); // NOI18N menuServiceSaveScreen.setText("Make Screenshot"); menuServiceSaveScreen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuServiceSaveScreenActionPerformed(evt); } }); menuService.add(menuServiceSaveScreen); menuTapExportAs.setIcon(new javax.swing.ImageIcon( getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_record.png"))); // NOI18N menuTapExportAs.setText("Export TAPE as.."); menuTapExportAsWav.setText("WAV file"); menuTapExportAsWav.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTapExportAsWavActionPerformed(evt); } }); menuTapExportAs.add(menuTapExportAsWav); menuService.add(menuTapExportAs); menuTracer.setText("Trace"); menuTraceCPU0.setText("CPU0"); menuTraceCPU0.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTraceCPU0ActionPerformed(evt); } }); menuTracer.add(menuTraceCPU0); menuTraceCPU1.setText("CPU1"); menuTraceCPU1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTraceCPU1ActionPerformed(evt); } }); menuTracer.add(menuTraceCPU1); menuTraceCPU2.setText("CPU2"); menuTraceCPU2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTraceCPU2ActionPerformed(evt); } }); menuTracer.add(menuTraceCPU2); menuTraceCPU3.setText("CPU3"); menuTraceCPU3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuTraceCPU3ActionPerformed(evt); } }); menuTracer.add(menuTraceCPU3); menuService.add(menuTracer); menuBar.add(menuService); menuOptions.setText("Options"); menuOptionsShowIndicators.setSelected(true); menuOptionsShowIndicators.setText("Indicator panel"); menuOptionsShowIndicators.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/indicator.png"))); // NOI18N menuOptionsShowIndicators.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuOptionsShowIndicatorsActionPerformed(evt); } }); menuOptions.add(menuOptionsShowIndicators); menuOptionsZX128Mode.setSelected(true); menuOptionsZX128Mode.setText("ZX 128 Mode"); menuOptionsZX128Mode.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/zx128.png"))); // NOI18N menuOptionsZX128Mode.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuOptionsZX128ModeActionPerformed(evt); } }); menuOptions.add(menuOptionsZX128Mode); menuOptionsTurbo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0)); menuOptionsTurbo.setSelected(true); menuOptionsTurbo.setText("Turbo"); menuOptionsTurbo.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/turbo.png"))); // NOI18N menuOptionsTurbo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuOptionsTurboActionPerformed(evt); } }); menuOptions.add(menuOptionsTurbo); menuBar.add(menuOptions); menuHelp.setText("Help"); menuHelpAbout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0)); menuHelpAbout.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/info.png"))); // NOI18N menuHelpAbout.setText("About"); menuHelpAbout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuHelpAboutActionPerformed(evt); } }); menuHelp.add(menuHelpAbout); menuBar.add(menuHelp); setJMenuBar(menuBar); pack(); }
From source file:Display.java
void changeAfterLauncher() { labelLauncher.setText("Instalowanie Launcher'a zakoczone!"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); zamknijButton.addActionListener(e -> System.exit(0)); zamknijButton.setEnabled(true);/*w w w . jav a2s . co m*/ JOptionPane.showMessageDialog(panel, "Instalacja zakoczona pomylnie!", "Instalacja", JOptionPane.INFORMATION_MESSAGE); }
From source file:com.jamfsoftware.jss.healthcheck.ui.HealthReport.java
/** * Creates a new Health Report JPanel window from the Health Check JSON string. * Will throw errors if the JSON is not formatted correctly. *///from w ww .j a va2 s . c om public HealthReport(final String JSON) throws Exception { LOGGER.debug("[DEBUG] - JSON String (Copy entire below line)"); LOGGER.debug(JSON.replace("\n", "")); LOGGER.debug("Attempting to parse Health Report JSON"); JsonElement report = new JsonParser().parse(JSON); JsonObject healthcheck = ((JsonObject) report).get("healthcheck").getAsJsonObject(); Boolean show_system_info = true; JsonObject system = null; //Check if the check JSON contains system information and show/hide panels accordingly later. system = ((JsonObject) report).get("system").getAsJsonObject(); final JsonObject data = ((JsonObject) report).get("checkdata").getAsJsonObject(); this.JSSURL = extractData(healthcheck, "jss_url"); if (extractData(system, "iscloudjss").contains("true")) { show_system_info = false; isCloudJSS = true; } PanelIconGenerator iconGen = new PanelIconGenerator(); PanelGenerator panelGen = new PanelGenerator(); //Top Level Frame final JFrame frame = new JFrame("JSS Health Check Report"); //Top Level Content JPanel outer = new JPanel(new BorderLayout()); //Two Blank Panels for the Sides JPanel blankLeft = new JPanel(); blankLeft.add(new JLabel(" ")); JPanel blankRight = new JPanel(); blankRight.add(new JLabel(" ")); blankLeft.setMinimumSize(new Dimension(100, 100)); blankRight.setMinimumSize(new Dimension(100, 100)); //Header JPanel header = new JPanel(); header.add(new JLabel("Total Computers: " + extractData(healthcheck, "totalcomputers"))); header.add(new JLabel("Total Mobile Devices: " + extractData(healthcheck, "totalmobile"))); header.add(new JLabel("Total Users: " + extractData(healthcheck, "totalusers"))); int total_devices = Integer.parseInt(extractData(healthcheck, "totalcomputers")) + Integer.parseInt(extractData(healthcheck, "totalmobile")); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss"); Date dateobj = new Date(); header.add(new JLabel("JSS Health Check Report Performed On " + df.format(dateobj))); //Foooter JPanel footer = new JPanel(); JButton view_report_json = new JButton("View Report JSON"); footer.add(view_report_json); JButton view_activation_code = new JButton("View Activation Code"); footer.add(view_activation_code); JButton test_again = new JButton("Run Test Again"); footer.add(test_again); JButton view_text_report = new JButton("View Text Report"); footer.add(view_text_report); JButton about_and_terms = new JButton("About and Terms"); footer.add(about_and_terms); //Middle Content, set the background white and give it a border JPanel content = new JPanel(new GridLayout(2, 3)); content.setBackground(Color.WHITE); content.setBorder(BorderFactory.createLineBorder(Color.BLACK)); //Setup Outer Placement outer.add(header, BorderLayout.NORTH); outer.add(footer, BorderLayout.SOUTH); outer.add(blankLeft, BorderLayout.WEST); outer.add(blankRight, BorderLayout.EAST); outer.add(content, BorderLayout.CENTER); //Don't show system info if it is hosted. JPanel system_info = null; JPanel database_health = null; if (show_system_info) { //Read all of the System information variables from the JSON and perform number conversions. String[][] sys_info = { { "Operating System", extractData(system, "os") }, { "Java Version", extractData(system, "javaversion") }, { "Java Vendor", extractData(system, "javavendor") }, { "Processor Cores", extractData(system, "proc_cores") }, { "Is Clustered?", extractData(system, "clustering") }, { "Web App Directory", extractData(system, "webapp_dir") }, { "Free Memory", Double.toString( round((Double.parseDouble(extractData(system, "free_memory")) / 1000000000), 2)) + " GB" }, { "Max Memory", Double.toString( round((Double.parseDouble(extractData(system, "max_memory")) / 1000000000), 2)) + " GB" }, { "Memory currently in use", Double.toString(round( (Double.parseDouble(extractData(system, "memory_currently_in_use")) / 1000000000), 2)) + " GB" }, { "Total space", Double.toString( round((Double.parseDouble(extractData(system, "total_space")) / 1000000000), 2)) + " GB" }, { "Free Space", Double.toString(round( (Double.parseDouble(extractData(system, "usable_space")) / 1000000000), 2)) + " GB" } }; //Generate the system info panel. String systemInfoIcon = iconGen.getSystemInfoIconType( Integer.parseInt(extractData(healthcheck, "totalcomputers")) + Integer.parseInt(extractData(healthcheck, "totalmobile")), extractData(system, "javaversion"), Double.parseDouble(extractData(system, "max_memory"))); system_info = panelGen.generateContentPanelSystem("System Info", sys_info, "JSS Minimum Requirements", "http://www.jamfsoftware.com/resources/casper-suite-system-requirements/", systemInfoIcon); //Get all of the DB information. String[][] db_health = { { "Database Size", extractData(system, "database_size") + " MB" } }; if (extractData(system, "database_size").equals("0")) { db_health[0][0] = "Unable to connect to database."; } String[][] large_sql_tables = extractArrayData(system, "largeSQLtables", "table_name", "table_size"); String[][] db_health_for_display = ArrayUtils.addAll(db_health, large_sql_tables); //Generate the DB Health panel. String databaseIconType = iconGen.getDatabaseInfoIconType(total_devices, Double.parseDouble(extractData(system, "database_size")), extractArrayData(system, "largeSQLtables", "table_name", "table_size").length); database_health = panelGen.generateContentPanelSystem("Database Health", db_health_for_display, "Too Large SQL Tables", "https://google.com", databaseIconType); if (!databaseIconType.equals("green")) { this.showLargeDatabase = true; } } int password_strenth = 0; if (extractData(data, "password_strength", "uppercase?").contains("true")) { password_strenth++; } if (extractData(data, "password_strength", "lowercase?").contains("true")) { password_strenth++; } if (extractData(data, "password_strength", "number?").contains("true")) { password_strenth++; } if (extractData(data, "password_strength", "spec_chars?").contains("true")) { password_strenth++; } String password_strength_desc = ""; if (password_strenth == 4) { password_strength_desc = "Excellent"; } else if (password_strenth == 3 || password_strenth == 2) { password_strength_desc = "Good"; } else if (password_strenth == 1) { this.strongerPassword = true; password_strength_desc = "Poor"; } else { this.strongerPassword = true; password_strength_desc = "Needs Updating"; } if (extractData(data, "loginlogouthooks", "is_configured").contains("false")) { this.loginInOutHooks = true; } try { if (Integer.parseInt(extractData(data, "device_row_counts", "computers").trim()) != Integer .parseInt(extractData(data, "device_row_counts", "computers_denormalized").trim())) { this.computerDeviceTableCountMismatch = true; } if (Integer.parseInt(extractData(data, "device_row_counts", "mobile_devices").trim()) != Integer .parseInt(extractData(data, "device_row_counts", "mobile_devices_denormalized").trim())) { this.mobileDeviceTableCountMismatch = true; } } catch (Exception e) { System.out.println("Unable to parse device row counts."); } if ((extractData(system, "mysql_version").contains("5.6.16") || extractData(system, "mysql_version").contains("5.6.20")) && (extractData(system, "os").contains("OS X") || extractData(system, "os").contains("Mac") || extractData(system, "os").contains("OSX"))) { this.mysql_osx_version_bug = true; } //Get all of the information for the JSS ENV and generate the panel. String[][] env_info = { { "Checkin Frequency", extractData(data, "computercheckin", "frequency") + " Minutes" }, { "Log Flushing", extractData(data, "logflushing", "log_flush_time") }, { "Log In/Out Hooks", extractData(data, "loginlogouthooks", "is_configured") }, { "Computer EA", extractData(data, "computerextensionattributes", "count") }, { "Mobile Deivce EA", extractData(data, "mobiledeviceextensionattributes", "count") }, { "Password Strength", password_strength_desc }, { "SMTP Server", extractData(data, "smtpserver", "server") }, { "Sender Email", extractData(data, "smtpserver", "sender_email") }, { "GSX Connection", extractData(data, "gsxconnection", "status") } }; String[][] vpp_accounts = extractArrayData(data, "vppaccounts", "name", "days_until_expire"); String[][] ldap_servers = extractArrayData(data, "ldapservers", "name", "type", "address", "id"); String envIconType = iconGen.getJSSEnvIconType(Integer.parseInt(extractData(healthcheck, "totalcomputers")), Integer.parseInt(extractData(data, "computercheckin", "frequency")), Integer.parseInt(extractData(data, "computerextensionattributes", "count")), Integer.parseInt(extractData(data, "mobiledeviceextensionattributes", "count"))); JPanel env = panelGen.generateContentPanelEnv("JSS Environment", env_info, vpp_accounts, ldap_servers, "", "", envIconType); //Get all of the group information from the JSON, merge the arrays, and then generate the groups JPanel. String[][] groups_1 = ArrayUtils.addAll( extractArrayData(data, "computergroups", "name", "nested_groups_count", "criteria_count", "id"), extractArrayData(data, "mobiledevicegroups", "name", "nested_groups_count", "criteria_count", "id")); String[][] groups_2 = ArrayUtils.addAll(groups_1, extractArrayData(data, "usergroups", "name", "nested_groups_count", "criteria_count", "id")); String groupIconType = iconGen.getGroupIconType("groups", countJSONObjectSize(data, "computergroups") + countJSONObjectSize(data, "mobiledevicegroups") + countJSONObjectSize(data, "usergroups")); JPanel groups = panelGen.generateContentPanelGroups("Groups", groups_2, "", "", groupIconType); if (groupIconType.equals("yellow") || groupIconType.equals("red")) { this.showGroupsHelp = true; } //Get all of the information for the printers, policies and scripts, then generate the panel. String[][] printers = extractArrayData(data, "printer_warnings", "model"); String[][] policies = extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger"); String[][] scripts = extractArrayData(data, "scripts_needing_update", "name"); String[][] certs = { { "SSL Cert Issuer", extractData(data, "tomcat", "ssl_cert_issuer") }, { "SLL Cert Expires", extractData(data, "tomcat", "cert_expires") }, { "MDM Push Cert Expires", extractData(data, "push_cert_expirations", "mdm_push_cert") }, { "Push Proxy Expires", extractData(data, "push_cert_expirations", "push_proxy") }, { "Change Management Enabled?", extractData(data, "changemanagment", "isusinglogfile") }, { "Log File Path:", extractData(data, "changemanagment", "logpath") } }; String policiesScriptsIconType = iconGen.getPoliciesAndScriptsIconType( extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger").length, extractArrayData(data, "scripts_needing_update", "name").length); JPanel policies_scripts = panelGen.generateContentPanelPoliciesScripts( "Policies, Scripts, Certs and Change", policies, scripts, printers, certs, "", "", policiesScriptsIconType); if (extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger").length > 0) { this.showPolicies = true; } if (extractArrayData(data, "scripts_needing_update", "name").length > 0) { this.showScripts = true; } if (extractData(data, "changemanagment", "isusinglogfile").contains("false")) { this.showChange = true; } this.showCheckinFreq = iconGen.showCheckinFreq; this.showExtensionAttributes = iconGen.showCheckinFreq; this.showSystemRequirements = iconGen.showSystemRequirements; this.showScalability = iconGen.showScalability; //Update Panel Gen Variables updatePanelGenVariables(panelGen); //Generate the Help Section. content.add(panelGen.generateContentPanelHelp("Modifications to Consider", "", "", "blank")); //If contains system information, add those panels, otherwise just continue adding the rest of the panels. if (show_system_info) { content.add(system_info); content.add(database_health); } content.add(env); content.add(groups); content.add(policies_scripts); //View report action listner. //Opens a window with the health report JSON listed view_report_json.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JPanel middlePanel = new JPanel(); middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "Health Report JSON")); // create the middle panel components JTextArea display = new JTextArea(16, 58); display.setEditable(false); //Make a new GSON object so the text can be Pretty Printed. Gson gson = new GsonBuilder().setPrettyPrinting().create(); String pp_json = gson.toJson(JSON.trim()); display.append(JSON); JScrollPane scroll = new JScrollPane(display); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); //Add Textarea in to middle panel middlePanel.add(scroll); JFrame frame = new JFrame(); frame.add(middlePanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); //Action listener for the Terms, About and Licence button. //Opens a new window with the AS IS License, 3rd Party Libs used and a small about section about_and_terms.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JPanel middlePanel = new JPanel(); middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "About, Licence and Terms")); // create the middle panel components JTextArea display = new JTextArea(16, 58); display.setEditable(false); display.append(StringConstants.ABOUT); display.append("\n\nThird Party Libraries Used:"); display.append( " Apache Commons Codec, Google JSON (gson), Java X JSON, JDOM, JSON-Simple, MySQL-connector"); display.append(StringConstants.LICENSE); JScrollPane scroll = new JScrollPane(display); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); //Add Textarea in to middle panel middlePanel.add(scroll); JFrame frame = new JFrame(); frame.add(middlePanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); //Listener for a button click to open a window containing the activation code. view_activation_code.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(frame, extractData(data, "activationcode", "code") + "\nExpires: " + extractData(data, "activationcode", "expires")); } }); view_text_report.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JPanel middlePanel = new JPanel(); middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "Text Health Report")); // create the middle panel components JTextArea display = new JTextArea(16, 58); display.setEditable(false); //Make a new GSON object so the text can be Pretty Printed. display.append(new HealthReportHeadless(JSON).getReportString()); JScrollPane scroll = new JScrollPane(display); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); //Add Textarea in to middle panel middlePanel.add(scroll); JFrame frame = new JFrame(); frame.add(middlePanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); //Listener for the Test Again button. Opens a new UserPrompt object and keeps the Health Report open in the background. test_again.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { new UserPrompt(); } catch (Exception ex) { ex.printStackTrace(); } } }); frame.add(outer); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true); DetectVM vm_checker = new DetectVM(); if (EnvironmentUtil.isMac()) { if (vm_checker.getIsVM()) { JOptionPane.showMessageDialog(new JFrame(), "The tool has detected that it is running in a OSX Virtual Machine.\nThe opening of links is not supported on OSX VMs.\nPlease open the tool on a non-VM computer and run it again OR\nyou can also copy the JSON from the report to a non-VM OR view the text report.\nIf you are not running a VM, ignore this message.", "VM Detected", JOptionPane.ERROR_MESSAGE); } } }
From source file:com.willwinder.universalgcodesender.MainWindow.java
/** This method is called from within the constructor to * initialize the form.//from w w w. java 2s . c o m * 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() { java.awt.GridBagConstraints gridBagConstraints; lineBreakGroup = new javax.swing.ButtonGroup(); jTabbedPane1 = new javax.swing.JTabbedPane(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem4 = new javax.swing.JMenuItem(); jogUnitsGroup = new javax.swing.ButtonGroup(); scrollWindowCheckBox = new javax.swing.JCheckBox(); bottomTabbedPane = new javax.swing.JTabbedPane(); commandsPanel = new javax.swing.JPanel(); commandLabel = new javax.swing.JLabel(); commandTextField = new com.willwinder.universalgcodesender.uielements.CommandTextArea(backend); consoleScrollPane = new javax.swing.JScrollPane(); consoleTextArea = new javax.swing.JTextArea(); commandTableScrollPane = new javax.swing.JScrollPane(); commandTable = new com.willwinder.universalgcodesender.uielements.GcodeTable(); controlContextTabbedPane = new javax.swing.JTabbedPane(); machineControlPanel = new javax.swing.JPanel(); helpButtonMachineControl = new javax.swing.JButton(); resetYButton = new javax.swing.JButton(); softResetMachineControl = new javax.swing.JButton(); requestStateInformation = new javax.swing.JButton(); returnToZeroButton = new javax.swing.JButton(); toggleCheckMode = new javax.swing.JButton(); resetCoordinatesButton = new javax.swing.JButton(); performHomingCycleButton = new javax.swing.JButton(); killAlarmLock = new javax.swing.JButton(); resetXButton = new javax.swing.JButton(); resetZButton = new javax.swing.JButton(); keyboardMovementPanel = new javax.swing.JPanel(); stepSizeSpinner = new javax.swing.JSpinner(); arrowMovementEnabled = new javax.swing.JCheckBox(); movementButtonPanel = new javax.swing.JPanel(); zMinusButton = new javax.swing.JButton(); yMinusButton = new javax.swing.JButton(); xPlusButton = new javax.swing.JButton(); xMinusButton = new javax.swing.JButton(); zPlusButton = new javax.swing.JButton(); yPlusButton = new javax.swing.JButton(); stepSizeLabel = new javax.swing.JLabel(); inchRadioButton = new javax.swing.JRadioButton(); mmRadioButton = new javax.swing.JRadioButton(); macroPane = new javax.swing.JScrollPane(); macroPanel = new com.willwinder.universalgcodesender.uielements.MacroPanel(settings, backend); connectionPanel = new javax.swing.JPanel(); commPortComboBox = new javax.swing.JComboBox(); baudrateSelectionComboBox = new javax.swing.JComboBox(); opencloseButton = new javax.swing.JButton(); refreshButton = new javax.swing.JButton(); baudLabel = new javax.swing.JLabel(); portLabel = new javax.swing.JLabel(); firmwareLabel = new javax.swing.JLabel(); firmwareComboBox = new javax.swing.JComboBox(); showVerboseOutputCheckBox = new javax.swing.JCheckBox(); statusPanel = new javax.swing.JPanel(); activeStateLabel = new javax.swing.JLabel(); activeStateValueLabel = new javax.swing.JLabel(); machinePosition = new javax.swing.JLabel(); machinePositionXLabel = new javax.swing.JLabel(); machinePositionYLabel = new javax.swing.JLabel(); machinePositionZLabel = new javax.swing.JLabel(); workPositionLabel = new javax.swing.JLabel(); workPositionXLabel = new javax.swing.JLabel(); workPositionYLabel = new javax.swing.JLabel(); workPositionZLabel = new javax.swing.JLabel(); machinePositionXValueLabel = new javax.swing.JLabel(); machinePositionYValueLabel = new javax.swing.JLabel(); machinePositionZValueLabel = new javax.swing.JLabel(); workPositionXValueLabel = new javax.swing.JLabel(); workPositionYValueLabel = new javax.swing.JLabel(); workPositionZValueLabel = new javax.swing.JLabel(); latestCommentValueLabel = new javax.swing.JLabel(); latestCommentLabel = new javax.swing.JLabel(); showCommandTableCheckBox = new javax.swing.JCheckBox(); fileModePanel = new javax.swing.JPanel(); sendButton = new javax.swing.JButton(); pauseButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); visualizeButton = new javax.swing.JButton(); browseButton = new javax.swing.JButton(); saveButton = new javax.swing.JButton(); fileRunPanel = new javax.swing.JPanel(); remainingTimeValueLabel = new javax.swing.JLabel(); sentRowsValueLabel = new javax.swing.JLabel(); remainingRowsLabel = new javax.swing.JLabel(); rowsValueLabel = new javax.swing.JLabel(); remainingTimeLabel = new javax.swing.JLabel(); durationValueLabel = new javax.swing.JLabel(); durationLabel = new javax.swing.JLabel(); remainingRowsValueLabel = new javax.swing.JLabel(); sentRowsLabel = new javax.swing.JLabel(); rowsLabel = new javax.swing.JLabel(); mainMenuBar = new javax.swing.JMenuBar(); settingsMenu = new javax.swing.JMenu(); grblConnectionSettingsMenuItem = new javax.swing.JMenuItem(); firmwareSettingsMenu = new javax.swing.JMenu(); grblFirmwareSettingsMenuItem = new javax.swing.JMenuItem(); PendantMenu = new javax.swing.JMenu(); startPendantServerButton = new javax.swing.JMenuItem(); stopPendantServerButton = new javax.swing.JMenuItem(); jMenuItem1.setText("jMenuItem1"); jMenuItem3.setText("jMenuItem3"); jMenuItem4.setText("jMenuItem4"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMinimumSize(new java.awt.Dimension(640, 520)); scrollWindowCheckBox.setSelected(true); scrollWindowCheckBox.setText("Scroll output window"); scrollWindowCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { scrollWindowCheckBoxActionPerformed(evt); } }); bottomTabbedPane.setBorder(javax.swing.BorderFactory.createTitledBorder("")); bottomTabbedPane.setMinimumSize(new java.awt.Dimension(0, 0)); bottomTabbedPane.setPreferredSize(new java.awt.Dimension(468, 100)); commandsPanel.setLayout(new java.awt.GridBagLayout()); commandLabel.setText("Command"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; commandsPanel.add(commandLabel, gridBagConstraints); commandTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { commandTextFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; commandsPanel.add(commandTextField, gridBagConstraints); consoleTextArea.setEditable(false); consoleTextArea.setColumns(20); consoleTextArea.setDocument(new LengthLimitedDocument(consoleSize)); consoleTextArea.setRows(5); consoleTextArea.setMaximumSize(new java.awt.Dimension(32767, 32767)); consoleTextArea.setMinimumSize(new java.awt.Dimension(0, 0)); consoleScrollPane.setViewportView(consoleTextArea); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; commandsPanel.add(consoleScrollPane, gridBagConstraints); bottomTabbedPane.addTab("Commands", commandsPanel); commandTable.setMaximumSize(new java.awt.Dimension(32767, 32767)); commandTable.getTableHeader().setReorderingAllowed(false); commandTableScrollPane.setViewportView(commandTable); bottomTabbedPane.addTab("Command Table", commandTableScrollPane); controlContextTabbedPane.setBorder(javax.swing.BorderFactory.createTitledBorder("")); controlContextTabbedPane.setMinimumSize(new java.awt.Dimension(395, 175)); controlContextTabbedPane.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentShown(java.awt.event.ComponentEvent evt) { controlContextTabbedPaneComponentShown(evt); } }); helpButtonMachineControl.setText("Help"); helpButtonMachineControl.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { helpButtonMachineControlActionPerformed(evt); } }); resetYButton.setText("Reset Y Axis"); resetYButton.setEnabled(false); resetYButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetYCoordinateButtonActionPerformed(evt); } }); softResetMachineControl.setText("Soft Reset"); softResetMachineControl.setEnabled(false); softResetMachineControl.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { softResetMachineControlActionPerformed(evt); } }); requestStateInformation.setText("$G"); requestStateInformation.setEnabled(false); requestStateInformation.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { requestStateInformationActionPerformed(evt); } }); returnToZeroButton.setText("Return to Zero"); returnToZeroButton.setEnabled(false); returnToZeroButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { returnToZeroButtonActionPerformed(evt); } }); toggleCheckMode.setText("$C"); toggleCheckMode.setEnabled(false); toggleCheckMode.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { toggleCheckModeActionPerformed(evt); } }); resetCoordinatesButton.setText("Reset Zero"); resetCoordinatesButton.setEnabled(false); resetCoordinatesButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetCoordinatesButtonActionPerformed(evt); } }); performHomingCycleButton.setText("$H"); performHomingCycleButton.setEnabled(false); performHomingCycleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { performHomingCycleButtonActionPerformed(evt); } }); killAlarmLock.setText("$X"); killAlarmLock.setEnabled(false); killAlarmLock.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { killAlarmLockActionPerformed(evt); } }); resetXButton.setText("Reset X Axis"); resetXButton.setEnabled(false); resetXButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetXCoordinateButtonActionPerformed(evt); } }); resetZButton.setText("Reset Z Axis"); resetZButton.setEnabled(false); resetZButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { resetZCoordinateButtonActionPerformed(evt); } }); keyboardMovementPanel.setPreferredSize(new java.awt.Dimension(247, 180)); stepSizeSpinner.setModel(new StepSizeSpinnerModel(1.0, 0.0, null, 1.0)); stepSizeSpinner.setEnabled(false); stepSizeSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { stepSizeSpinnerStateChanged(evt); } }); arrowMovementEnabled.setText("Enable Keyboard Movement"); arrowMovementEnabled.setEnabled(false); zMinusButton.setText("Z-"); zMinusButton.setEnabled(false); zMinusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { zMinusButtonActionPerformed(evt); } }); yMinusButton.setText("Y-"); yMinusButton.setEnabled(false); yMinusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { yMinusButtonActionPerformed(evt); } }); xPlusButton.setText("X+"); xPlusButton.setEnabled(false); xPlusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { xPlusButtonActionPerformed(evt); } }); xMinusButton.setText("X-"); xMinusButton.setEnabled(false); xMinusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { xMinusButtonActionPerformed(evt); } }); zPlusButton.setText("Z+"); zPlusButton.setEnabled(false); zPlusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { zPlusButtonActionPerformed(evt); } }); yPlusButton.setText("Y+"); yPlusButton.setEnabled(false); yPlusButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { yPlusButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout movementButtonPanelLayout = new org.jdesktop.layout.GroupLayout( movementButtonPanel); movementButtonPanel.setLayout(movementButtonPanelLayout); movementButtonPanelLayout.setHorizontalGroup(movementButtonPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(movementButtonPanelLayout.createSequentialGroup() .add(xMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(movementButtonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(yPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(yMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(xPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(movementButtonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, zMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, zPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))); movementButtonPanelLayout.setVerticalGroup( movementButtonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(movementButtonPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER) .add(xMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(xPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(movementButtonPanelLayout.createSequentialGroup() .add(yPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(yMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(movementButtonPanelLayout.createSequentialGroup() .add(zPlusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(zMinusButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))); stepSizeLabel.setText("Step size:"); stepSizeLabel.setEnabled(false); jogUnitsGroup.add(inchRadioButton); inchRadioButton.setText("inch"); inchRadioButton.setEnabled(false); inchRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { inchRadioButtonActionPerformed(evt); } }); jogUnitsGroup.add(mmRadioButton); mmRadioButton.setText("millimeters"); mmRadioButton.setEnabled(false); mmRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mmRadioButtonActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout keyboardMovementPanelLayout = new org.jdesktop.layout.GroupLayout( keyboardMovementPanel); keyboardMovementPanel.setLayout(keyboardMovementPanelLayout); keyboardMovementPanelLayout.setHorizontalGroup(keyboardMovementPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(keyboardMovementPanelLayout.createSequentialGroup().add(keyboardMovementPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(arrowMovementEnabled) .add(keyboardMovementPanelLayout.createSequentialGroup().addContainerGap() .add(keyboardMovementPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(keyboardMovementPanelLayout.createSequentialGroup() .add(keyboardMovementPanelLayout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING) .add(inchRadioButton).add(stepSizeLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(keyboardMovementPanelLayout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING) .add(stepSizeSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 70, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(mmRadioButton))) .add(movementButtonPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(23, Short.MAX_VALUE))); keyboardMovementPanelLayout.setVerticalGroup(keyboardMovementPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(keyboardMovementPanelLayout.createSequentialGroup().add(arrowMovementEnabled) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(keyboardMovementPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(stepSizeLabel) .add(stepSizeSpinner, 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(keyboardMovementPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER) .add(inchRadioButton).add(mmRadioButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(movementButtonPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(46, Short.MAX_VALUE))); keyboardMovementPanelLayout.linkSize(new java.awt.Component[] { stepSizeLabel, stepSizeSpinner }, org.jdesktop.layout.GroupLayout.VERTICAL); org.jdesktop.layout.GroupLayout machineControlPanelLayout = new org.jdesktop.layout.GroupLayout( machineControlPanel); machineControlPanel.setLayout(machineControlPanelLayout); machineControlPanelLayout.setHorizontalGroup(machineControlPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(machineControlPanelLayout.createSequentialGroup().add(machineControlPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(machineControlPanelLayout.createSequentialGroup() .add(requestStateInformation, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 49, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(helpButtonMachineControl)) .add(resetCoordinatesButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 159, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(returnToZeroButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 159, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(softResetMachineControl, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 159, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(machineControlPanelLayout.createSequentialGroup() .add(performHomingCycleButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 49, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(6, 6, 6) .add(killAlarmLock, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 49, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(6, 6, 6).add(toggleCheckMode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 49, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .add(6, 6, 6) .add(machineControlPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(resetXButton).add(resetYButton).add(resetZButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 65, Short.MAX_VALUE) .add(keyboardMovementPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))); machineControlPanelLayout.setVerticalGroup(machineControlPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(machineControlPanelLayout.createSequentialGroup().add(machineControlPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(machineControlPanelLayout.createSequentialGroup().add(resetCoordinatesButton) .add(6, 6, 6).add(returnToZeroButton).add(6, 6, 6).add(softResetMachineControl) .add(6, 6, 6) .add(machineControlPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(performHomingCycleButton).add(killAlarmLock).add(toggleCheckMode)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(machineControlPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(requestStateInformation).add(helpButtonMachineControl))) .add(machineControlPanelLayout.createSequentialGroup().add(resetXButton).add(6, 6, 6) .add(resetYButton).add(6, 6, 6).add(resetZButton))) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(keyboardMovementPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)); controlContextTabbedPane.addTab("Machine Control", machineControlPanel); macroPane.setViewportView(macroPanel); controlContextTabbedPane.addTab("Macros", macroPane); connectionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Connection")); connectionPanel.setMaximumSize(new java.awt.Dimension(247, 100)); connectionPanel.setMinimumSize(new java.awt.Dimension(247, 100)); connectionPanel.setName("Connection"); // NOI18N connectionPanel.setPreferredSize(new java.awt.Dimension(247, 100)); commPortComboBox.setEditable(true); baudrateSelectionComboBox.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "2400", "4800", "9600", "19200", "38400", "57600", "115200" })); baudrateSelectionComboBox.setSelectedIndex(2); baudrateSelectionComboBox.setToolTipText("Select baudrate to use for the serial port."); baudrateSelectionComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { baudrateSelectionComboBoxActionPerformed(evt); } }); opencloseButton.setText("Open"); opencloseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { opencloseButtonActionPerformed(evt); } }); refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/refresh.gif"))); // NOI18N refreshButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { refreshButtonActionPerformed(evt); } }); baudLabel.setText("Baud:"); portLabel.setText("Port:"); firmwareLabel.setText("Firmware:"); org.jdesktop.layout.GroupLayout connectionPanelLayout = new org.jdesktop.layout.GroupLayout( connectionPanel); connectionPanel.setLayout(connectionPanelLayout); connectionPanelLayout.setHorizontalGroup(connectionPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(connectionPanelLayout.createSequentialGroup().addContainerGap().add(connectionPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(org.jdesktop.layout.GroupLayout.TRAILING, connectionPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(connectionPanelLayout.createSequentialGroup().add(portLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(commPortComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 183, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(connectionPanelLayout.createSequentialGroup().add(baudLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(baudrateSelectionComboBox, 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(refreshButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(opencloseButton))) .add(connectionPanelLayout.createSequentialGroup().add(firmwareLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(firmwareComboBox, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap())); connectionPanelLayout.setVerticalGroup(connectionPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(connectionPanelLayout.createSequentialGroup() .add(connectionPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(commPortComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(portLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(connectionPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(connectionPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(baudLabel).add(baudrateSelectionComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(refreshButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 24, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(opencloseButton)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(connectionPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(firmwareLabel).add(firmwareComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); showVerboseOutputCheckBox.setText("Show verbose output"); statusPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Machine status")); statusPanel.setMinimumSize(new java.awt.Dimension(247, 160)); statusPanel.setPreferredSize(new java.awt.Dimension(247, 160)); activeStateLabel.setText("Active State:"); activeStateLabel.setOpaque(true); activeStateValueLabel.setText(" "); activeStateValueLabel.setOpaque(true); machinePosition.setText("Machine Position:"); machinePositionXLabel.setText("X:"); machinePositionYLabel.setText("Y:"); machinePositionZLabel.setText("Z:"); workPositionLabel.setText("Work Position:"); workPositionXLabel.setText("X:"); workPositionYLabel.setText("Y:"); workPositionZLabel.setText("Z:"); machinePositionXValueLabel.setText("0"); machinePositionYValueLabel.setText("0"); machinePositionZValueLabel.setText("0"); workPositionXValueLabel.setText("0"); workPositionYValueLabel.setText("0"); workPositionZValueLabel.setText("0"); latestCommentValueLabel.setText(" "); latestCommentLabel.setText("Latest Comment:"); org.jdesktop.layout.GroupLayout statusPanelLayout = new org.jdesktop.layout.GroupLayout(statusPanel); statusPanel.setLayout(statusPanelLayout); statusPanelLayout.setHorizontalGroup(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(statusPanelLayout.createSequentialGroup().addContainerGap().add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(statusPanelLayout.createSequentialGroup().add(latestCommentLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(latestCommentValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(statusPanelLayout.createSequentialGroup().add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(statusPanelLayout.createSequentialGroup().add(activeStateLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(activeStateValueLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .add(statusPanelLayout.createSequentialGroup().add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(workPositionLabel) .add(statusPanelLayout.createSequentialGroup().add(17, 17, 17) .add(statusPanelLayout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING, false) .add(statusPanelLayout.createSequentialGroup() .add(workPositionZLabel) .addPreferredGap( org.jdesktop.layout.LayoutStyle.RELATED) .add(workPositionZValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(statusPanelLayout.createSequentialGroup() .add(workPositionYLabel) .addPreferredGap( org.jdesktop.layout.LayoutStyle.RELATED) .add(workPositionYValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(statusPanelLayout.createSequentialGroup() .add(workPositionXLabel) .addPreferredGap( org.jdesktop.layout.LayoutStyle.RELATED) .add(workPositionXValueLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 65, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(machinePosition) .add(statusPanelLayout.createSequentialGroup().add(17, 17, 17) .add(statusPanelLayout .createParallelGroup( org.jdesktop.layout.GroupLayout.LEADING, false) .add(statusPanelLayout.createSequentialGroup() .add(machinePositionZLabel) .addPreferredGap( org.jdesktop.layout.LayoutStyle.RELATED) .add(machinePositionZValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(statusPanelLayout.createSequentialGroup() .add(machinePositionYLabel) .addPreferredGap( org.jdesktop.layout.LayoutStyle.RELATED) .add(machinePositionYValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(statusPanelLayout.createSequentialGroup() .add(machinePositionXLabel) .addPreferredGap( org.jdesktop.layout.LayoutStyle.RELATED) .add(machinePositionXValueLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 65, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))))) .add(0, 0, Short.MAX_VALUE))) .addContainerGap())); statusPanelLayout.setVerticalGroup(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(statusPanelLayout.createSequentialGroup() .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(activeStateLabel).add(activeStateValueLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(latestCommentLabel).add(latestCommentValueLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(statusPanelLayout.createSequentialGroup().add(workPositionLabel) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(workPositionXLabel).add(workPositionXValueLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(workPositionYLabel).add(workPositionYValueLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(workPositionZLabel).add(workPositionZValueLabel))) .add(statusPanelLayout.createSequentialGroup().add(machinePosition) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(machinePositionXLabel).add(machinePositionXValueLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(machinePositionYLabel).add(machinePositionYValueLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(machinePositionZLabel).add(machinePositionZValueLabel)))) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); showCommandTableCheckBox.setSelected(true); showCommandTableCheckBox.setText("Enable command table"); showCommandTableCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showCommandTableCheckBoxActionPerformed(evt); } }); fileModePanel.setMinimumSize(new java.awt.Dimension(389, 150)); fileModePanel.setPreferredSize(new java.awt.Dimension(247, 258)); fileModePanel.setLayout(new java.awt.GridBagLayout()); sendButton.setText("Send"); sendButton.setEnabled(false); sendButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sendButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; fileModePanel.add(sendButton, gridBagConstraints); pauseButton.setText("Pause"); pauseButton.setEnabled(false); pauseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pauseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipadx = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; fileModePanel.add(pauseButton, gridBagConstraints); cancelButton.setText("Cancel"); cancelButton.setEnabled(false); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; fileModePanel.add(cancelButton, gridBagConstraints); visualizeButton.setText("Visualize"); visualizeButton.setEnabled(false); visualizeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { visualizeButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; fileModePanel.add(visualizeButton, gridBagConstraints); browseButton.setText("Browse"); browseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browseButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; fileModePanel.add(browseButton, gridBagConstraints); saveButton.setText("Save"); saveButton.setEnabled(false); saveButton.setMaximumSize(new java.awt.Dimension(88, 29)); saveButton.setMinimumSize(new java.awt.Dimension(88, 29)); saveButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; fileModePanel.add(saveButton, gridBagConstraints); remainingTimeValueLabel.setText("--:--:--"); sentRowsValueLabel.setText("0"); remainingRowsLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); remainingRowsLabel.setText("Remaining Rows:"); remainingRowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); remainingRowsLabel.setMaximumSize(null); remainingRowsLabel.setMinimumSize(new java.awt.Dimension(106, 14)); remainingRowsLabel.setPreferredSize(new java.awt.Dimension(106, 14)); rowsValueLabel.setText("0"); remainingTimeLabel.setText("Estimated Time Remaining:"); durationValueLabel.setText("00:00:00"); durationLabel.setText("Duration:"); remainingRowsValueLabel.setText("0"); sentRowsLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); sentRowsLabel.setText("Sent Rows:"); sentRowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); sentRowsLabel.setMaximumSize(null); sentRowsLabel.setMinimumSize(new java.awt.Dimension(106, 14)); sentRowsLabel.setPreferredSize(new java.awt.Dimension(106, 14)); rowsLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); rowsLabel.setText("Rows In File:"); rowsLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); rowsLabel.setMinimumSize(new java.awt.Dimension(106, 14)); rowsLabel.setPreferredSize(new java.awt.Dimension(106, 14)); org.jdesktop.layout.GroupLayout fileRunPanelLayout = new org.jdesktop.layout.GroupLayout(fileRunPanel); fileRunPanel.setLayout(fileRunPanelLayout); fileRunPanelLayout .setHorizontalGroup(fileRunPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fileRunPanelLayout.createSequentialGroup().add(0, 0, 0) .add(fileRunPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, remainingRowsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, remainingTimeLabel) .add(org.jdesktop.layout.GroupLayout.TRAILING, sentRowsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, durationLabel) .add(org.jdesktop.layout.GroupLayout.TRAILING, rowsLabel, 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(fileRunPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(durationValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(remainingRowsValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(sentRowsValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(remainingTimeValueLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(rowsValueLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 56, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); fileRunPanelLayout.setVerticalGroup(fileRunPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(fileRunPanelLayout.createSequentialGroup().addContainerGap() .add(fileRunPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(rowsValueLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(rowsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(fileRunPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(sentRowsValueLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(sentRowsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(fileRunPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(remainingRowsValueLabel).add(remainingRowsLabel, 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(fileRunPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(remainingTimeLabel).add(remainingTimeValueLabel)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(fileRunPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(durationLabel).add(durationValueLabel)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; fileModePanel.add(fileRunPanel, gridBagConstraints); settingsMenu.setText("Settings"); grblConnectionSettingsMenuItem.setText("Sender Settings"); grblConnectionSettingsMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { grblConnectionSettingsMenuItemActionPerformed(evt); } }); settingsMenu.add(grblConnectionSettingsMenuItem); firmwareSettingsMenu.setText("Firmware Settings"); grblFirmwareSettingsMenuItem.setText("GRBL"); grblFirmwareSettingsMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { grblFirmwareSettingsMenuItemActionPerformed(evt); } }); firmwareSettingsMenu.add(grblFirmwareSettingsMenuItem); settingsMenu.add(firmwareSettingsMenu); mainMenuBar.add(settingsMenu); PendantMenu.setText("Pendant"); startPendantServerButton.setText("Start..."); startPendantServerButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { startPendantServerButtonActionPerformed(evt); } }); PendantMenu.add(startPendantServerButton); stopPendantServerButton.setText("Stop..."); stopPendantServerButton.setEnabled(false); stopPendantServerButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stopPendantServerButtonActionPerformed(evt); } }); PendantMenu.add(stopPendantServerButton); mainMenuBar.add(PendantMenu); setJMenuBar(mainMenuBar); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(connectionPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(statusPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(fileModePanel, 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(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, bottomTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(layout.createSequentialGroup().add(scrollWindowCheckBox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(showVerboseOutputCheckBox).add(18, 18, 18) .add(showCommandTableCheckBox).addContainerGap()) .add(controlContextTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))); layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup().addContainerGap() .add(layout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout .createSequentialGroup() .add(connectionPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(statusPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)) .add(layout.createSequentialGroup() .add(controlContextTabbedPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 283, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(scrollWindowCheckBox) .add(layout .createParallelGroup( org.jdesktop.layout.GroupLayout.BASELINE) .add(showVerboseOutputCheckBox) .add(showCommandTableCheckBox))))) .add(4, 4, 4) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(fileModePanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 203, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(0, 0, Short.MAX_VALUE)) .add(bottomTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)) .add(4, 4, 4))); pack(); }