From: <adr...@us...> - 2011-06-18 10:52:36
|
Revision: 4141 http://reprap.svn.sourceforge.net/reprap/?rev=4141&view=rev Author: adrian-bowyer Date: 2011-06-18 10:52:29 +0000 (Sat, 18 Jun 2011) Log Message: ----------- Fixed bug whereby java.awt buttons disappeared when tabs were selected by replacing them with javax.swing buttons. Modified Paths: -------------- trunk/software/host/.classpath trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java trunk/software/host/src/org/reprap/gui/botConsole/PrintTabFrame.java trunk/software/host/src/org/reprap/gui/botConsole/bedPanel.java Modified: trunk/software/host/.classpath =================================================================== --- trunk/software/host/.classpath 2011-06-16 19:38:22 UTC (rev 4140) +++ trunk/software/host/.classpath 2011-06-18 10:52:29 UTC (rev 4141) @@ -7,7 +7,7 @@ <classpathentry kind="lib" path="lib/j3d-org-java3d-all.jar"/> <classpathentry kind="lib" path="lib/j3dutils.jar"/> <classpathentry kind="lib" path="lib/vecmath.jar"/> - <classpathentry kind="lib" path="lib/swing-layout-1.0.3.jar"/> <classpathentry kind="lib" path="lib/RXTXcomm.jar"/> + <classpathentry kind="lib" path="lib/swing-layout-1.0.4.jar"/> <classpathentry kind="output" path="bin"/> </classpath> Modified: trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java 2011-06-16 19:38:22 UTC (rev 4140) +++ trunk/software/host/src/org/reprap/gui/botConsole/BotConsoleFrame.java 2011-06-18 10:52:29 UTC (rev 4141) @@ -179,7 +179,40 @@ if (extruderCount < 1) throw new Exception("A Reprap printer must contain at least one extruder"); } + private void initialiseExtruderPanels() { + + extruderPanels = new GenericExtruderTabPanel[extruderCount]; + for (int i = 0; i < extruderCount; i++) { + extruderPanels[i] = new GenericExtruderTabPanel(); + try { + extruderPanels[i].initialiseExtruders(i); + } + catch (Exception e) { + System.out.println("Failure trying to initialise extruders in botConsole: " + e); + JOptionPane.showMessageDialog(null, e.getMessage()); + return; + } + try { + extruderPanels[i].setPrefs(); + } + catch (Exception e) { + System.out.println("Problem loading prefs for Extruder " + i); + JOptionPane.showMessageDialog(null, "Problem loading prefs for Extruder " + i); + } + } + } + private void addExtruderPanels() { + + xYZTabPanel = new org.reprap.gui.botConsole.XYZTabPanel(); + + jTabbedPane1.addTab("XYZ", xYZTabPanel); + for (int i = 0; i < extruderCount; i++) { + jTabbedPane1.addTab("Extruder " + i, extruderPanels[i]); + } + pack(); + } + /** This method is called from within the constructor to * initialize the form. @@ -191,7 +224,7 @@ jTabbedPane1 = new javax.swing.JTabbedPane(); initialiseExtruderPanels(); - printTabFrame1 = new org.reprap.gui.botConsole.PrintTabFrame(); + printTabFrame1 = new org.reprap.gui.botConsole.PrintTabFrame(false); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); @@ -214,7 +247,7 @@ .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 400, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(5, Short.MAX_VALUE)) ); - + pack(); }// </editor-fold>//GEN-END:initComponents @@ -278,43 +311,10 @@ return bcf.extruderPanels[0]; } - private void initialiseExtruderPanels() { + - extruderPanels = new GenericExtruderTabPanel[extruderCount]; - for (int i = 0; i < extruderCount; i++) { - extruderPanels[i] = new GenericExtruderTabPanel(); - try { - extruderPanels[i].initialiseExtruders(i); - } - catch (Exception e) { - System.out.println("Failure trying to initialise extruders in botConsole: " + e); - JOptionPane.showMessageDialog(null, e.getMessage()); - return; - } - try { - extruderPanels[i].setPrefs(); - } - catch (Exception e) { - System.out.println("Problem loading prefs for Extruder " + i); - JOptionPane.showMessageDialog(null, "Problem loading prefs for Extruder " + i); - } - } - } - - private void addExtruderPanels() { - - xYZTabPanel = new org.reprap.gui.botConsole.XYZTabPanel(); - jTabbedPane1.addTab("XYZ", xYZTabPanel); - for (int i = 0; i < extruderCount; i++) { - jTabbedPane1.addTab("Extruder " + i, extruderPanels[i]); - } - pack(); - } - - - private int extruderCount; //private int currentExtruder; Modified: trunk/software/host/src/org/reprap/gui/botConsole/PrintTabFrame.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/PrintTabFrame.java 2011-06-16 19:38:22 UTC (rev 4140) +++ trunk/software/host/src/org/reprap/gui/botConsole/PrintTabFrame.java 2011-06-18 10:52:29 UTC (rev 4141) @@ -23,7 +23,8 @@ * * @author ensab */ -public class PrintTabFrame extends javax.swing.JInternalFrame { +public class PrintTabFrame extends javax.swing.JInternalFrame {//AB99 +//public class PrintTabFrame extends javax.swing.JPanel { private static final long serialVersionUID = 1L; private BotConsoleFrame parentBotConsoleFrame = null; // private XYZTabPanel xYZTabPanel = null; @@ -39,8 +40,8 @@ private boolean gcodeLoaded = false; /** Creates new form PrintTabFrame */ - public PrintTabFrame() { - initComponents(); + public PrintTabFrame(boolean pref) { + initComponents(pref); String machine = "simulator"; //toSNAPRepRapRadioButton.setSelected(false); @@ -141,13 +142,71 @@ * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { + private void initComponents(boolean pref) { buttonGroup1 = new javax.swing.ButtonGroup(); - printButton = new java.awt.Button(); - pcbButton = new java.awt.Button(); - pauseButton = new java.awt.Button(); - stopButton = new java.awt.Button(); - exitButton = new java.awt.Button(); + + // if(pref) + // { + //preferencesButton = new java.awt.Button(); + preferencesButton = new javax.swing.JButton(); + preferencesButton.setActionCommand("preferences"); + preferencesButton.setBackground(new java.awt.Color(255, 102, 255)); + preferencesButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + preferences(evt); + } + }); + //preferencesButton.setLabel("Preferences"); + preferencesButton.setText("Preferences"); + // return; + // } + + // If this isn't here it falls over. God knows why... + dummyButton = new java.awt.Button(); + dummyButton.setActionCommand("dummy"); + dummyButton.setBackground(new java.awt.Color(238, 238, 238)); + dummyButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + dummy(evt); + } + }); + dummyButton.setLabel(" "); + + + printButton = new javax.swing.JButton(); + pcbButton = new javax.swing.JButton(); + pauseButton = new javax.swing.JButton(); + stopButton = new javax.swing.JButton(); + exitButton = new javax.swing.JButton(); + loadSTL = new javax.swing.JButton(); + loadGCode = new javax.swing.JButton(); + loadRFO = new javax.swing.JButton(); +// preferencesButton = new javax.swing.JButton(); + saveRFO = new javax.swing.JButton(); + + // printButton = new java.awt.Button(); + // pcbButton = new java.awt.Button(); + // pauseButton = new java.awt.Button(); + // stopButton = new java.awt.Button(); + // exitButton = new java.awt.Button(); + // loadSTL = new java.awt.Button(); + // loadGCode = new java.awt.Button(); + // loadRFO = new java.awt.Button(); + +// saveRFO = new java.awt.Button(); + + + printButton.setText("Print"); + pcbButton.setText("PCB"); + pauseButton.setText("Pause"); + stopButton.setText("STOP !"); + exitButton.setText("Exit"); + loadSTL.setText("Load STL"); + loadGCode.setText("Load GCode"); + loadRFO.setText("Load RFO"); + saveRFO.setText("Save RFO"); + + layerPauseCheck = new javax.swing.JCheckBox(); layerPause(false); //toSNAPRepRapRadioButton = new javax.swing.JRadioButton(); @@ -160,20 +219,18 @@ progressLabel = new javax.swing.JLabel(); currentLayerOutOfN = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); - loadSTL = new java.awt.Button(); - loadGCode = new java.awt.Button(); + gCodeToFileRadioButton = new javax.swing.JRadioButton(); - loadRFO = new java.awt.Button(); + toGCodeRepRapRadioButton = new javax.swing.JRadioButton(); fileNameBox = new javax.swing.JLabel(); - preferencesButton = new java.awt.Button(); - saveRFO = new java.awt.Button(); + displayPathsCheck = new javax.swing.JCheckBox(); displayPaths(false); printButton.setBackground(new java.awt.Color(51, 204, 0)); printButton.setFont(printButton.getFont()); - printButton.setLabel("Print"); // NOI18N + // NOI18N printButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { printButtonActionPerformed(evt); @@ -182,7 +239,7 @@ pcbButton.setBackground(new java.awt.Color(152, 99, 62)); pcbButton.setFont(pcbButton.getFont()); - pcbButton.setLabel("PCB"); // NOI18N + // NOI18N pcbButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pcbButtonActionPerformed(evt); @@ -190,7 +247,7 @@ }); pauseButton.setBackground(new java.awt.Color(255, 204, 0)); - pauseButton.setLabel("Pause"); // NOI18N + // NOI18N pauseButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pauseButtonActionPerformed(evt); @@ -199,14 +256,14 @@ stopButton.setBackground(new java.awt.Color(255, 0, 0)); stopButton.setFont(new java.awt.Font("Dialog", 1, 12)); - stopButton.setLabel("STOP !"); // NOI18N + // NOI18N stopButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stopButtonActionPerformed(evt); } }); - exitButton.setLabel("Exit"); + exitButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitButtonActionPerformed(evt); @@ -220,13 +277,6 @@ } }); -// buttonGroup1.add(toSNAPRepRapRadioButton); -// toSNAPRepRapRadioButton.setText("Print on SNAP RepRap"); -// toSNAPRepRapRadioButton.addMouseListener(new java.awt.event.MouseAdapter() { -// public void mousePressed(java.awt.event.MouseEvent evt) { -// selectorRadioButtonMousePressed(evt); -// } -// }); getWebPage.setIcon(new javax.swing.ImageIcon( ClassLoader.getSystemResource("rr-logo-green-url.png"))); // NOI18N @@ -260,7 +310,7 @@ loadSTL.setActionCommand("loadSTL"); loadSTL.setBackground(new java.awt.Color(0, 204, 255)); - loadSTL.setLabel("Load STL"); // NOI18N + // NOI18N loadSTL.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadSTL(evt); @@ -269,7 +319,7 @@ loadGCode.setActionCommand("loadGCode"); loadGCode.setBackground(new java.awt.Color(0, 204, 255)); - loadGCode.setLabel("Load GCode"); // NOI18N + // NOI18N loadGCode.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { LoadGCode(evt); @@ -286,7 +336,7 @@ loadRFO.setActionCommand("loadRFO"); loadRFO.setBackground(new java.awt.Color(0, 204, 255)); - loadRFO.setLabel("Load RFO"); // NOI18N + // NOI18N loadRFO.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadRFO(evt); @@ -304,24 +354,40 @@ fileNameBox.setFont(new java.awt.Font("Tahoma", 0, 12)); fileNameBox.setText(" - "); - preferencesButton.setActionCommand("preferences"); - preferencesButton.setBackground(new java.awt.Color(255, 102, 255)); - preferencesButton.setLabel("Preferences"); // NOI18N - preferencesButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - preferences(evt); - } - }); + saveRFO.setActionCommand("saveRFO"); saveRFO.setBackground(new java.awt.Color(153, 153, 153)); - saveRFO.setLabel("Save RFO"); // NOI18N + // NOI18N saveRFO.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveRFO(evt); } }); + + + + + + + + + // printButton.setLabel("Print"); + // pcbButton.setLabel("PCB"); + // pauseButton.setLabel("Pause"); +// stopButton.setLabel("STOP !"); +// exitButton.setLabel("Exit"); +// loadSTL.setLabel("Load STL"); +// loadGCode.setLabel("Load GCode"); +// loadRFO.setLabel("Load RFO"); + +// saveRFO.setLabel("Save RFO"); + + + + + displayPathsCheck.setText("Display paths"); displayPathsCheck.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { @@ -329,8 +395,9 @@ } }); - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());//AB99 getContentPane().setLayout(layout); + //this.setLayout(layout);//AB99 layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() @@ -338,12 +405,12 @@ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) - .add(pcbButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(saveRFO, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(loadGCode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(pcbButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(saveRFO, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(loadGCode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(loadRFO, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .add(loadSTL, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) + .add(loadRFO, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(loadSTL, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 120, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) //.add(toSNAPRepRapRadioButton) @@ -356,15 +423,19 @@ .add(layout.createSequentialGroup() .add(preferencesButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(getWebPage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 190, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(dummyButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(getWebPage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 190, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + ) .add(layout.createSequentialGroup() + .add(printButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) //.add(pcbButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) //.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(pauseButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 78, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(stopButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(stopButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 85, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(exitButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 62, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) .add(layout.createSequentialGroup() @@ -397,7 +468,8 @@ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(getWebPage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(getWebPage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 72, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + ) .add(layout.createSequentialGroup() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() @@ -411,7 +483,9 @@ .add(toGCodeRepRapRadioButton) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(gCodeToFileRadioButton)) - .add(preferencesButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(preferencesButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(dummyButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + ) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() @@ -451,8 +525,8 @@ .add(progressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap(24, Short.MAX_VALUE)) ); - - pack(); + + //pack(); //AB99 }// </editor-fold>//GEN-END:initComponents private void printButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printButtonActionPerformed @@ -765,6 +839,10 @@ prefs.setVisible(true); // prefs.show(); }//GEN-LAST:event_preferences +private void dummy(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_preferences + +}//GEN-LAST:event_preferences + private void saveRFO(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveRFO if(!SLoadOK) return; @@ -838,27 +916,50 @@ private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JLabel currentLayerOutOfN; private javax.swing.JCheckBox displayPathsCheck; - private java.awt.Button exitButton; + private javax.swing.JLabel expectedBuildTime; private javax.swing.JLabel expectedBuildTimeLabel; private javax.swing.JLabel expectedFinishTime; private javax.swing.JLabel expectedFinishTimeLabel; private javax.swing.JLabel fileNameBox; private javax.swing.JRadioButton gCodeToFileRadioButton; - private javax.swing.JButton getWebPage; + private javax.swing.JLabel hoursMinutesLabel1; private javax.swing.JCheckBox layerPauseCheck; - private java.awt.Button loadGCode; - private java.awt.Button loadRFO; - private java.awt.Button loadSTL; - private java.awt.Button pauseButton; - private java.awt.Button preferencesButton; - private java.awt.Button printButton; - private java.awt.Button pcbButton; + + private javax.swing.JButton getWebPage; + + private javax.swing.JButton loadGCode; + private javax.swing.JButton loadRFO; + private javax.swing.JButton loadSTL; + private javax.swing.JButton pauseButton; + private javax.swing.JButton preferencesButton; + private javax.swing.JButton printButton; + private javax.swing.JButton pcbButton; + private javax.swing.JButton exitButton; + private javax.swing.JButton saveRFO; + private javax.swing.JButton stopButton; + + + + // private java.awt.Button loadGCode; + // private java.awt.Button loadRFO; +// private java.awt.Button loadSTL; +// private java.awt.Button pauseButton; +// private java.awt.Button preferencesButton; + + private java.awt.Button dummyButton; +// private java.awt.Button printButton; +// private java.awt.Button pcbButton; +// private java.awt.Button exitButton; +// private java.awt.Button saveRFO; +// private java.awt.Button stopButton; + + + private javax.swing.JProgressBar progressBar; private javax.swing.JLabel progressLabel; - private java.awt.Button saveRFO; - private java.awt.Button stopButton; + private javax.swing.JRadioButton toGCodeRepRapRadioButton; //private javax.swing.JRadioButton toSNAPRepRapRadioButton; // End of variables declaration//GEN-END:variables Modified: trunk/software/host/src/org/reprap/gui/botConsole/bedPanel.java =================================================================== --- trunk/software/host/src/org/reprap/gui/botConsole/bedPanel.java 2011-06-16 19:38:22 UTC (rev 4140) +++ trunk/software/host/src/org/reprap/gui/botConsole/bedPanel.java 2011-06-18 10:52:29 UTC (rev 4141) @@ -1,176 +1,176 @@ /* * * !!!!! - * NOTE: PLEASE ONLY EDIT THIS USING THE NETBEANS IDE 6.0.1 OR HIGHER!!!! - * !!!!! - * - * ... an .xml file is associated with this class. Cheers. - * - * bedPanel.java - * - * Created on 30 March 2008, 18:55 - */ - -package org.reprap.gui.botConsole; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; -import java.awt.font.FontRenderContext; -import java.awt.geom.Line2D; -import java.awt.geom.Point2D; - -/** - * - * @author reprap - */ -public class bedPanel extends javax.swing.JPanel { - private static final long serialVersionUID = 1L; - private final int CROSS_HAIR_SIZE = 10; - private Line2D.Double a1, a2, b1, b2; - private Point2D.Double aDatum, bDatum; - private int x; - private int y; - private Font font; - private int fontSize; - - /** Creates new form bedPanel */ - public bedPanel() { - - // First cross hair - aDatum = new Point2D.Double(); - a1 = new Line2D.Double(); - a2 = new Line2D.Double(); - - // History cross hair - bDatum = new Point2D.Double(); - b1 = new Line2D.Double(); - b2 = new Line2D.Double(); - - initComponents(); - - } - - public void setDimensions() { - x = this.getWidth(); - y = this.getHeight(); - - // Text imitialisation - fontSize = (int)(y/20); - font = new Font("dialog", Font.PLAIN, fontSize); - repaint(); - } - - /** 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. - */ - // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents - private void initComponents() { - - setBackground(java.awt.Color.white); - setMaximumSize(new java.awt.Dimension(200, 200)); - setMinimumSize(new java.awt.Dimension(200, 200)); - setPreferredSize(new java.awt.Dimension(200, 200)); - - org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 200, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(0, 200, Short.MAX_VALUE) - ); - }// </editor-fold>//GEN-END:initComponents - - public void mousePressed() { - unClicked = false; - } - - public void updateCrossHair(int posX, int posY) { - - c = Color.black; - - aDatum.setLocation(posX, posY); - a1.setLine(aDatum.getX(), aDatum.getY()-CROSS_HAIR_SIZE, aDatum.getX(), aDatum.getY()+CROSS_HAIR_SIZE); - a2.setLine(aDatum.getX()-CROSS_HAIR_SIZE, aDatum.getY(), aDatum.getX()+CROSS_HAIR_SIZE, aDatum.getY()); - - updateOldPosition(posX, posY); - - repaint(); - } - - public void updateOldPosition(int posX, int posY) { - - bDatum.setLocation(posX, posY); - b1.setLine(bDatum.getX(), bDatum.getY()-CROSS_HAIR_SIZE/2, bDatum.getX(), bDatum.getY()+CROSS_HAIR_SIZE/2); - b2.setLine(bDatum.getX()-CROSS_HAIR_SIZE/2, bDatum.getY(), bDatum.getX()+CROSS_HAIR_SIZE/2, bDatum.getY()); - } - - public void dragCrossHair(int posX, int posY) { - - c = Color.red; - - aDatum.setLocation(posX, posY); - a1.setLine(aDatum.getX(), aDatum.getY()-x, aDatum.getX(), aDatum.getY()+x); - a2.setLine(aDatum.getX()-x, aDatum.getY(), aDatum.getX()+x, aDatum.getY()); - - repaint(); - } - - public void paintComponent(Graphics g) { - super.paintComponent(g); - Graphics2D g2 = (Graphics2D)g; - g2.setRenderingHint( - RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - g2.setRenderingHint( - RenderingHints.KEY_COLOR_RENDERING, - RenderingHints.VALUE_COLOR_RENDER_SPEED); - g2.setRenderingHint( - RenderingHints.KEY_RENDERING, - RenderingHints.VALUE_RENDER_SPEED); - g2.setColor(c); - g2.draw(a1); - g2.draw(a2); - - g2.setColor(Color.gray); - g2.draw(b1); - g2.draw(b2); - - if (unClicked) { - g2.setFont(font); - FontRenderContext frc = g2.getFontRenderContext(); - - float width; - float sx; - float sy; - float lineHeight = font.getSize(); - float space = font.getSize()/4; - int lines = s.length; - - for (int i = 0; i < lines; i++) { - width = (float)font.getStringBounds(s[i], frc).getWidth(); - sx = (x - width)/2; - sy = y/2+(lineHeight)/2 - (lines-1)*((lineHeight+space)/2) + (i*(lineHeight+space)); - g2.drawString(s[i], sx, sy); - } - } - } - - private Color c; - private boolean unClicked = true; - private String s1 = "Click to load new coordinates"; - private String s2 = "Drag for cross-hairs"; - private String s3 = ""; //"Home X & Y axes first"; - private String[] s = new String[] { s3, s1, s2 }; - - // Variables declaration - do not modify//GEN-BEGIN:variables - // End of variables declaration//GEN-END:variables - -} +// * NOTE: PLEASE ONLY EDIT THIS USING THE NETBEANS IDE 6.0.1 OR HIGHER!!!! +// * !!!!! +// * +// * ... an .xml file is associated with this class. Cheers. +// * +// * bedPanel.java +// * +// * Created on 30 March 2008, 18:55 +// */ +// +//package org.reprap.gui.botConsole; +// +//import java.awt.Color; +//import java.awt.Font; +//import java.awt.Graphics; +//import java.awt.Graphics2D; +//import java.awt.RenderingHints; +//import java.awt.font.FontRenderContext; +//import java.awt.geom.Line2D; +//import java.awt.geom.Point2D; +// +///** +// * +// * @author reprap +// */ +//public class bedPanel extends javax.swing.JPanel { +// private static final long serialVersionUID = 1L; +// private final int CROSS_HAIR_SIZE = 10; +// private Line2D.Double a1, a2, b1, b2; +// private Point2D.Double aDatum, bDatum; +// private int x; +// private int y; +// private Font font; +// private int fontSize; +// +// /** Creates new form bedPanel */ +// public bedPanel() { +// +// // First cross hair +// aDatum = new Point2D.Double(); +// a1 = new Line2D.Double(); +// a2 = new Line2D.Double(); +// +// // History cross hair +// bDatum = new Point2D.Double(); +// b1 = new Line2D.Double(); +// b2 = new Line2D.Double(); +// +// initComponents(); +// +// } +// +// public void setDimensions() { +// x = this.getWidth(); +// y = this.getHeight(); +// +// // Text imitialisation +// fontSize = (int)(y/20); +// font = new Font("dialog", Font.PLAIN, fontSize); +// repaint(); +// } +// +// /** 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. +// */ +// // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents +// private void initComponents() { +// +// setBackground(java.awt.Color.white); +// setMaximumSize(new java.awt.Dimension(200, 200)); +// setMinimumSize(new java.awt.Dimension(200, 200)); +// setPreferredSize(new java.awt.Dimension(200, 200)); +// +// org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); +// this.setLayout(layout); +// layout.setHorizontalGroup( +// layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +// .add(0, 200, Short.MAX_VALUE) +// ); +// layout.setVerticalGroup( +// layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +// .add(0, 200, Short.MAX_VALUE) +// ); +// }// </editor-fold>//GEN-END:initComponents +// +// public void mousePressed() { +// unClicked = false; +// } +// +// public void updateCrossHair(int posX, int posY) { +// +// c = Color.black; +// +// aDatum.setLocation(posX, posY); +// a1.setLine(aDatum.getX(), aDatum.getY()-CROSS_HAIR_SIZE, aDatum.getX(), aDatum.getY()+CROSS_HAIR_SIZE); +// a2.setLine(aDatum.getX()-CROSS_HAIR_SIZE, aDatum.getY(), aDatum.getX()+CROSS_HAIR_SIZE, aDatum.getY()); +// +// updateOldPosition(posX, posY); +// +// repaint(); +// } +// +// public void updateOldPosition(int posX, int posY) { +// +// bDatum.setLocation(posX, posY); +// b1.setLine(bDatum.getX(), bDatum.getY()-CROSS_HAIR_SIZE/2, bDatum.getX(), bDatum.getY()+CROSS_HAIR_SIZE/2); +// b2.setLine(bDatum.getX()-CROSS_HAIR_SIZE/2, bDatum.getY(), bDatum.getX()+CROSS_HAIR_SIZE/2, bDatum.getY()); +// } +// +// public void dragCrossHair(int posX, int posY) { +// +// c = Color.red; +// +// aDatum.setLocation(posX, posY); +// a1.setLine(aDatum.getX(), aDatum.getY()-x, aDatum.getX(), aDatum.getY()+x); +// a2.setLine(aDatum.getX()-x, aDatum.getY(), aDatum.getX()+x, aDatum.getY()); +// +// repaint(); +// } +// +// public void paintComponent(Graphics g) { +// super.paintComponent(g); +// Graphics2D g2 = (Graphics2D)g; +// g2.setRenderingHint( +// RenderingHints.KEY_ANTIALIASING, +// RenderingHints.VALUE_ANTIALIAS_ON); +// g2.setRenderingHint( +// RenderingHints.KEY_COLOR_RENDERING, +// RenderingHints.VALUE_COLOR_RENDER_SPEED); +// g2.setRenderingHint( +// RenderingHints.KEY_RENDERING, +// RenderingHints.VALUE_RENDER_SPEED); +// g2.setColor(c); +// g2.draw(a1); +// g2.draw(a2); +// +// g2.setColor(Color.gray); +// g2.draw(b1); +// g2.draw(b2); +// +// if (unClicked) { +// g2.setFont(font); +// FontRenderContext frc = g2.getFontRenderContext(); +// +// float width; +// float sx; +// float sy; +// float lineHeight = font.getSize(); +// float space = font.getSize()/4; +// int lines = s.length; +// +// for (int i = 0; i < lines; i++) { +// width = (float)font.getStringBounds(s[i], frc).getWidth(); +// sx = (x - width)/2; +// sy = y/2+(lineHeight)/2 - (lines-1)*((lineHeight+space)/2) + (i*(lineHeight+space)); +// g2.drawString(s[i], sx, sy); +// } +// } +// } +// +// private Color c; +// private boolean unClicked = true; +// private String s1 = "Click to load new coordinates"; +// private String s2 = "Drag for cross-hairs"; +// private String s3 = ""; //"Home X & Y axes first"; +// private String[] s = new String[] { s3, s1, s2 }; +// +// // Variables declaration - do not modify//GEN-BEGIN:variables +// // End of variables declaration//GEN-END:variables +// +//} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |