diff --git a/src/main/java/chart/Chart.java b/src/main/java/chart/Chart.java index 144840a..2e18980 100644 --- a/src/main/java/chart/Chart.java +++ b/src/main/java/chart/Chart.java @@ -193,7 +193,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver { float w = ctx.iwidth; float h = (int) (ctx.getY(i.open) - ctx.getY(i.close)); - System.out.printf("CLO: %f %f \n", w, h); + // System.out.printf("CLO: %f %f \n", w, h); g.setColor(Color.GREEN); g.fillRect((int) (x - w / 2), (int) ctx.getY(i.close), (int) w, (int) h); g.setColor(Color.BLACK); @@ -218,7 +218,12 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver { } private void draw(Graphics2D g) { - + + if (data == null ) + return; + if (data.size()==0) + return; + OHLCDataItem di0 = data.get(0); XLegendDef xld = new XLegendDef(); this.drawXLegend(g, xld); diff --git a/src/main/java/chart/NewJPanel.form b/src/main/java/chart/NewJPanel.form index 4b72163..e221c4b 100644 --- a/src/main/java/chart/NewJPanel.form +++ b/src/main/java/chart/NewJPanel.form @@ -16,29 +16,9 @@ - + - - - - - - - - - - - - - - - - - - - - - + @@ -46,109 +26,54 @@ - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - + - - - - - - - - - + + + + - - - - - - - - - - - - - + - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/chart/NewJPanel.java b/src/main/java/chart/NewJPanel.java index 513c986..5174a8f 100644 --- a/src/main/java/chart/NewJPanel.java +++ b/src/main/java/chart/NewJPanel.java @@ -47,37 +47,37 @@ public class NewJPanel extends javax.swing.JPanel { // //GEN-BEGIN:initComponents private void initComponents() { - jToolBar1 = new javax.swing.JToolBar(); - jButton1 = new javax.swing.JButton(); - jScrollPane1 = new javax.swing.JScrollPane(); - jList1 = new javax.swing.JList<>(); - jScrollPane2 = new javax.swing.JScrollPane(); - jTextArea1 = new javax.swing.JTextArea(); - jCheckBox1 = new javax.swing.JCheckBox(); - jScrollPane3 = new javax.swing.JScrollPane(); - jTextArea2 = new javax.swing.JTextArea(); - jSplitPane1 = new javax.swing.JSplitPane(); + jToolBar2 = new javax.swing.JToolBar(); + jButton3 = new javax.swing.JButton(); + jButton4 = new javax.swing.JButton(); + jButton5 = new javax.swing.JButton(); + jButton6 = new javax.swing.JButton(); - jToolBar1.setRollover(true); + jToolBar2.setRollover(true); - jButton1.setText("jButton1"); + jButton3.setText("jButton3"); + jButton3.setFocusable(false); + jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton3); - jList1.setModel(new javax.swing.AbstractListModel() { - String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; - public int getSize() { return strings.length; } - public String getElementAt(int i) { return strings[i]; } - }); - jScrollPane1.setViewportView(jList1); + jButton4.setText("jButton4"); + jButton4.setFocusable(false); + jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton4); - jTextArea1.setColumns(20); - jTextArea1.setRows(5); - jScrollPane2.setViewportView(jTextArea1); + jButton5.setText("jButton5"); + jButton5.setFocusable(false); + jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton5); - jCheckBox1.setText("jCheckBox1"); - - jTextArea2.setColumns(20); - jTextArea2.setRows(5); - jScrollPane3.setViewportView(jTextArea2); + jButton6.setText("jButton6"); + jButton6.setFocusable(false); + jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + jToolBar2.add(jButton6); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -85,58 +85,24 @@ public class NewJPanel extends javax.swing.JPanel { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jCheckBox1) - .addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE) - .addComponent(jScrollPane1)))) + .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 516, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGap(8, 8, 8) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addComponent(jCheckBox1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(43, 43, 43)) - .addComponent(jScrollPane3)) + .addContainerGap() + .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE) .addContainerGap()) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton jButton1; - private javax.swing.JCheckBox jCheckBox1; - private javax.swing.JList jList1; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JScrollPane jScrollPane2; - private javax.swing.JScrollPane jScrollPane3; - private javax.swing.JSplitPane jSplitPane1; - private javax.swing.JTextArea jTextArea1; - private javax.swing.JTextArea jTextArea2; - private javax.swing.JToolBar jToolBar1; + private javax.swing.JButton jButton3; + private javax.swing.JButton jButton4; + private javax.swing.JButton jButton5; + private javax.swing.JButton jButton6; + private javax.swing.JToolBar jToolBar2; // End of variables declaration//GEN-END:variables } diff --git a/src/main/java/gui/AboutDialog.form b/src/main/java/gui/AboutDialog.form index d070e78..7dde9bb 100644 --- a/src/main/java/gui/AboutDialog.form +++ b/src/main/java/gui/AboutDialog.form @@ -23,10 +23,15 @@ + + + + + - - - + + + @@ -34,17 +39,37 @@ - - + + + + - + + + + + + + + + + + + + + + + - + + + + diff --git a/src/main/java/gui/AboutDialog.java b/src/main/java/gui/AboutDialog.java index 4d98296..b855d50 100644 --- a/src/main/java/gui/AboutDialog.java +++ b/src/main/java/gui/AboutDialog.java @@ -49,11 +49,22 @@ public class AboutDialog extends javax.swing.JDialog { // //GEN-BEGIN:initComponents private void initComponents() { - jLabel1 = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTextPane1 = new javax.swing.JTextPane(); + jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - jLabel1.setText("jLabel1"); + jTextPane1.setEditable(false); + jTextPane1.setText("/*\n * Copyright (c) 2017, 7u83 <7u83@mail.ru>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */"); + jScrollPane1.setViewportView(jTextPane1); + + jButton1.setText("Close"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); @@ -61,20 +72,30 @@ public class AboutDialog extends javax.swing.JDialog { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 603, Short.MAX_VALUE) .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(247, 247, 247) + .addComponent(jButton1) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(45, Short.MAX_VALUE)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) ); pack(); }// //GEN-END:initComponents + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + this.dispose(); + }//GEN-LAST:event_jButton1ActionPerformed + /** * @param args the command line arguments */ @@ -119,6 +140,8 @@ public class AboutDialog extends javax.swing.JDialog { } // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel jLabel1; + private javax.swing.JButton jButton1; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextPane jTextPane1; // End of variables declaration//GEN-END:variables } diff --git a/src/main/java/gui/EditPreferencesDialog.form b/src/main/java/gui/EditPreferencesDialog.form new file mode 100644 index 0000000..4f9dcd3 --- /dev/null +++ b/src/main/java/gui/EditPreferencesDialog.form @@ -0,0 +1,106 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/gui/EditPreferencesDialog.java b/src/main/java/gui/EditPreferencesDialog.java new file mode 100644 index 0000000..c2e6715 --- /dev/null +++ b/src/main/java/gui/EditPreferencesDialog.java @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2017, 7u83 <7u83@mail.ru> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +package gui; + +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +/** + * + * @author 7u83 <7u83@mail.ru> + */ +public class EditPreferencesDialog extends javax.swing.JDialog { + + UIManager.LookAndFeelInfo[] lafInfo; + + /** + * Creates new form EditPreferencesDialog + */ + public EditPreferencesDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + + lafInfo = UIManager.getInstalledLookAndFeels(); + lafComboBox.removeAllItems(); + for (UIManager.LookAndFeelInfo lafInfo1 : lafInfo) { + lafComboBox.addItem(lafInfo1.getName()); + } + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + lafComboBox = new javax.swing.JComboBox<>(); + lafLabel = new javax.swing.JLabel(); + cancelButton = new javax.swing.JButton(); + applyButton = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + + lafComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + lafComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + lafComboBoxActionPerformed(evt); + } + }); + + lafLabel.setText("Look & Feel:"); + + cancelButton.setMnemonic('c'); + cancelButton.setText("Cancel"); + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cancelButtonActionPerformed(evt); + } + }); + + applyButton.setMnemonic('a'); + applyButton.setText("Apply"); + applyButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + applyButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(lafLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lafComboBox, 0, 276, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(applyButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(lafComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lafLabel)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 236, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(cancelButton) + .addComponent(applyButton)) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private void lafComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lafComboBoxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_lafComboBoxActionPerformed + + private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed + this.dispose(); + }//GEN-LAST:event_cancelButtonActionPerformed + + private void applyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyButtonActionPerformed + String selected = (String) this.lafComboBox.getSelectedItem(); + + System.out.printf("Selected %s\n", selected); + + for (UIManager.LookAndFeelInfo lafInfo1 : this.lafInfo) { + if (lafInfo1.getName().equals(selected)) { + String x = lafInfo1.getClassName(); + System.out.printf("Set Callsname: %s\n", x); + try { + UIManager.setLookAndFeel(x); + SwingUtilities.updateComponentTreeUI(MainWin.instance); + MainWin.instance.pack(); + } catch (Exception e) { + + } + } + } + + + }//GEN-LAST:event_applyButtonActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(EditPreferencesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(EditPreferencesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(EditPreferencesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(EditPreferencesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + EditPreferencesDialog dialog = new EditPreferencesDialog(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton applyButton; + private javax.swing.JButton cancelButton; + private javax.swing.JComboBox lafComboBox; + private javax.swing.JLabel lafLabel; + // End of variables declaration//GEN-END:variables +} diff --git a/src/main/java/gui/MainWin.form b/src/main/java/gui/MainWin.form index 02e9131..e3feeb3 100644 --- a/src/main/java/gui/MainWin.form +++ b/src/main/java/gui/MainWin.form @@ -46,13 +46,26 @@ - + + + + + + + + + + + + + + diff --git a/src/main/java/gui/MainWin.java b/src/main/java/gui/MainWin.java index b083d29..4112794 100644 --- a/src/main/java/gui/MainWin.java +++ b/src/main/java/gui/MainWin.java @@ -38,6 +38,7 @@ import traders.*; */ public class MainWin extends javax.swing.JFrame { + static MainWin instance; static public sesim.Exchange se; //static sesim.Account_old myAccount; @@ -106,7 +107,8 @@ public class MainWin extends javax.swing.JFrame { FileMenu = new javax.swing.JMenu(); FileNew = new javax.swing.JMenuItem(); FileRun = new javax.swing.JMenuItem(); - jMenu2 = new javax.swing.JMenu(); + editjMenu = new javax.swing.JMenu(); + editPrefernces = new javax.swing.JMenuItem(); viewMenu = new javax.swing.JMenu(); traderList = new javax.swing.JMenuItem(); helpMenu = new javax.swing.JMenu(); @@ -149,9 +151,21 @@ public class MainWin extends javax.swing.JFrame { MainMenu.add(FileMenu); - jMenu2.setText("Edit"); - MainMenu.add(jMenu2); + editjMenu.setMnemonic('e'); + editjMenu.setText("Edit"); + editPrefernces.setMnemonic('p'); + editPrefernces.setText("Preferences"); + editPrefernces.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + editPreferncesActionPerformed(evt); + } + }); + editjMenu.add(editPrefernces); + + MainMenu.add(editjMenu); + + viewMenu.setMnemonic('v'); viewMenu.setText("View"); traderList.setMnemonic('t'); @@ -208,6 +222,11 @@ public class MainWin extends javax.swing.JFrame { tl.setVisible(true); }//GEN-LAST:event_traderListActionPerformed + private void editPreferncesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editPreferncesActionPerformed + EditPreferencesDialog d = new EditPreferencesDialog(this,true); + d.setVisible(true); + }//GEN-LAST:event_editPreferncesActionPerformed + /** * @param args the command line arguments */ @@ -289,7 +308,9 @@ public class MainWin extends javax.swing.JFrame { /* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { - new MainWin().setVisible(true); + MainWin.instance=new MainWin(); + MainWin.instance.setVisible(true); + }); } @@ -299,11 +320,12 @@ public class MainWin extends javax.swing.JFrame { private javax.swing.JMenuItem FileRun; private javax.swing.JMenuBar MainMenu; private gui.ControlPanel controlPanel2; + private javax.swing.JMenuItem editPrefernces; + private javax.swing.JMenu editjMenu; private chart.FullChart fullChart2; private javax.swing.JMenuItem helpAbout; private javax.swing.JMenu helpMenu; private javax.swing.JButton jButton1; - private javax.swing.JMenu jMenu2; private javax.swing.JMenuItem jMenuItem1; private gui.OrderBookPanel orderBookPanel1; private javax.swing.JMenuItem traderList;