Results 1 to 17 of 17
Thread: cant run my program
- 03-06-2011, 08:30 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
- 03-06-2011, 08:33 AM #2
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
my program
This is my program. i dunno why it cant run. Can you kindly help me check. thanks!!
package fyp;
import javax.swing.JDesktopPane;
import javax.swing.JPanel;
import java.awt.GridBagLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
import java.awt.BorderLayout;
public class coverpage {
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="227,72"
private JPanel jContentPane = null;
private JDesktopPane jDesktopPane= null;
/**
* This method initializes jFrame
*
* @return javax.swing.JFrame
*/
private JFrame getJFrame() {
if (jFrame == null) {
jFrame = new JFrame();
jFrame.setTitle("MOM-normal stress");
Dimension ScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
jFrame.setSize(ScreenSize);
jFrame.validate();
jFrame.setContentPane(getJContentPane());
}
return jFrame;
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getJDesktopPane(), BorderLayout.CENTER);
}
return jContentPane;
}
public JDesktopPane getJDesktopPane() {
if (jDesktopPane == null) {
jDesktopPane = new JDesktopPane();
jDesktopPane.setLayout(new BorderLayout());
helpdesk homepage = new helpdesk(coverpage.this);
jDesktopPane.removeAll();
jDesktopPane.add(homepage.getJPanel(),BorderLayout .CENTER);
}
return jDesktopPane;
}
/**
* @param args
*/
public static void main(String[] args) {
coverpage frame = new coverpage();
frame.getJFrame().setVisible(true);
// TODO Auto-generated method stub
}
}
- 03-06-2011, 08:45 AM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Does it compile? I saw a class 'helpdesk'; can the compiler find that class?
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-06-2011, 08:53 AM #4
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
how to compile it??
best regards
Ivy Yiew
- 03-06-2011, 08:58 AM #5
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
RE
Make sure that your package is compiled before compiling the code....
- 03-06-2011, 09:07 AM #6
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
now i can link to my other page.. but i dunno why i cant link to my "helpdesk"
this is my codes for my "helpdesk"
--------------------------------------------------------------------------
Java Code:package fyp; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import javax.swing.JOptionPane; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.JSpinner; import javax.swing.SpinnerModel; import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.Color; import javax.swing.JLabel; import java.awt.Rectangle; import java.awt.GridBagLayout; import java.text.DecimalFormat; import javax.swing.JRadioButton; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JTextArea; public class helpdesk { coverpage home = null; DecimalFormat df=new DecimalFormat("#.###"); // @jve:decl-index=0: private JPanel jPanel = null; // @jve:decl-index=0:visual-constraint="4,4" private JLabel jLabel = null; private JLabel jLabel1 = null; private JPanel jPanel1 = null; private JLabel jLabel2 = null; private JLabel jLabel3 = null; private JLabel jLabel4 = null; private JLabel jLabel5 = null; private JLabel jLabel6 = null; private JLabel jLabel7 = null; private JLabel jLabel8 = null; private JPanel jPanel2 = null; private JPanel jPanel3 = null; private JPanel jPanel4 = null; private JPanel jPanel5 = null; private JPanel jPanel6 = null; private JPanel jPanel7 = null; private JPanel jPanel9 = null; private JButton jButton = null; public void clearSpinnerValue() { input1.setValue(0.0); input2.setValue(0.0); input3.setValue(0.0); input4.setValue(0.0); input5.setValue(0.0); } SpinnerModel model1 = new SpinnerNumberModel(new Double(0.00), new Double( 0.00), new Double(9999.99), new Double(0.01)); // @jve:decl-index=0: JSpinner input1 = new JSpinner(model1); SpinnerModel model2 = new SpinnerNumberModel(new Double(0.00), new Double( 0.00), new Double(9999.99), new Double(0.01)); // @jve:decl-index=0: JSpinner input2 = new JSpinner(model2); SpinnerModel model3 = new SpinnerNumberModel(new Double(0.00), new Double( 0.00), new Double(9999.99), new Double(0.01)); // @jve:decl-index=0: JSpinner input3 = new JSpinner(model3); SpinnerModel model4 = new SpinnerNumberModel(new Double(0.00), new Double( 0.00), new Double(9999.99), new Double(0.01)); // @jve:decl-index=0: JSpinner input4 = new JSpinner(model4); SpinnerModel model5 = new SpinnerNumberModel(new Double(0.00), new Double( 0.00), new Double(9999.99), new Double(0.01)); // @jve:decl-index=0: JSpinner input5 = new JSpinner(model5); private JLabel jLabel9 = null; private JLabel jLabel10 = null; private JLabel jLabel11 = null; private JLabel jLabel12 = null; private JLabel jLabel13 = null; private JLabel jLabel14 = null; ButtonGroup K = new ButtonGroup(); ButtonGroup A = new ButtonGroup(); // @jve:decl-index=0: private JRadioButton jRadioButton = null; private JRadioButton jRadioButton1 = null; private JRadioButton jRadioButton2 = null; private JRadioButton jRadioButton3 = null; private JRadioButton jRadioButton4 = null; private JRadioButton jRadioButton5 = null; private JTextField jTextField = null; private JTextField jTextField1 = null; private JTextField jTextField2 = null; private JTextField jTextField3 = null; private JTextField jTextField4 = null; private JTextField jTextField5 = null; private JTextField jTextField6 = null; private JLabel jLabel15 = null; private JLabel jLabel16 = null; private JLabel jLabel17 = null; private JLabel jLabel18 = null; private JLabel jLabel19 = null; private JLabel jLabel20 = null; private JRadioButton jRadioButton6 = null; private JRadioButton jRadioButton7 = null; private JRadioButton jRadioButton8 = null; private JRadioButton jRadioButton9 = null; private JRadioButton jRadioButton10 = null; private JLabel jLabel25 = null; private JLabel jLabel26 = null; private JLabel jLabel27 = null; private JLabel jLabel28 = null; private JLabel jLabel29 = null; private JLabel jLabel30 = null; private JLabel jLabel31 = null; private JRadioButton jRadioButton11 = null; private JRadioButton jRadioButton12 = null; private JRadioButton jRadioButton13 = null; private JLabel jLabel32 = null; private JLabel jLabel33 = null; private JLabel jLabel34 = null; private JLabel jLabel35 = null; private JLabel jLabel36 = null; private JLabel jLabel37 = null; private JLabel jLabel38 = null; private JLabel jLabel39 = null; private JLabel jLabel40 = null; private JTextField jTextField11 = null; private JLabel jLabel41 = null; private JLabel jLabel42 = null; private JLabel jLabel43 = null; private JLabel jLabel44 = null; private JLabel jLabel45 = null; private JLabel jLabel46 = null; private JTextField jTextField12 = null; private JTextField jTextField13 = null; private JTextField jTextField14 = null; private JTextField jTextField15 = null; private JTextField jTextField16 = null; private JTextField jTextField17 = null; private JLabel jLabel47 = null; private JLabel jLabel48 = null; private JLabel jLabel49 = null; private JLabel jLabel50 = null; private JTextField jTextField18 = null; private JTextField jTextField19 = null; private JTextField jTextField20 = null; private JLabel jLabel51 = null; private JLabel jLabel52 = null; private JLabel jLabel53 = null; private JLabel jLabel54 = null; private JLabel jLabel55 = null; private JLabel jLabel56 = null; private JLabel jLabel57 = null; private JLabel jLabel58 = null; private JTextField jTextField21 = null; private JLabel jLabel59 = null; private JLabel jLabel21 = null; private JLabel jLabel22 = null; private JTextField jTextField7 = null; private JTextField jTextField8 = null; private JLabel jLabel23 = null; private JTextField jTextField9 = null; private JLabel jLabel24 = null; private JLabel jLabel60 = null; private JLabel jLabel61 = null; private JLabel jLabel62 = null; private JLabel jLabel63 = null; private JLabel jLabel64 = null; private JLabel jLabel65 = null; private JLabel jLabel66 = null; private JLabel jLabel67 = null; private JLabel jLabel68 = null; private JLabel jLabel69 = null; private JLabel jLabel70 = null; private JLabel jLabel71 = null; private JLabel jLabel72 = null; private JLabel jLabel73 = null; private JLabel jLabel74 = null; private JLabel jLabel75 = null; private JLabel jLabel76 = null; public helpdesk(coverpage home){ this.home=home;} JPanel getJPanel() { if (jPanel == null) { input1.setBounds(new Rectangle(220, 50, 50, 20)); jLabel = new JLabel(); jLabel.setBounds(new Rectangle(10, 5, 91, 37)); jLabel.setFont(new Font("Dialog", Font.BOLD, 20)); jLabel.setForeground(new Color(255, 102, 51)); jLabel.setText("Helpdesk"); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; jPanel = new JPanel(); jPanel.setLayout(null); jPanel.setSize(new Dimension(1275, 750)); jPanel.setBackground(new Color(102, 0, 0)); jPanel.add(jLabel, null); jPanel.add(jLabel1, null); jPanel.add(getJPanel1(), null); jPanel.add(getJPanel2(), null); jPanel.add(getJPanel3(), null); jPanel.add(getJPanel4(), null); jPanel.add(getJPanel5(), null); jPanel.add(getJPanel7(), null); jPanel.add(getJPanel9(), null); jPanel.add(getJButton(), null); } return jPanel; } /** * This method initializes jPanel1 * * @return javax.swing.JPanel */ private JPanel getJPanel1() { if (jPanel1 == null) { jLabel8 = new JLabel(); jLabel8.setIcon(new ImageIcon(getClass().getResource( "/shapes/rectangle.png"))); jLabel8.setBounds(new Rectangle(570, 25, 24, 50)); jLabel7 = new JLabel(); jLabel7.setIcon(new ImageIcon(getClass().getResource( "/shapes/circlehole.png"))); jLabel7.setBounds(new Rectangle(470, 25, 47, 49)); jLabel6 = new JLabel(); jLabel6.setIcon(new ImageIcon(getClass().getResource( "/shapes/circle.png"))); jLabel6.setBounds(new Rectangle(370, 25, 44, 46)); jLabel5 = new JLabel(); jLabel5.setIcon(new ImageIcon(getClass().getResource( "/shapes/Ishape.png"))); jLabel5.setBounds(new Rectangle(270, 25, 41, 50)); jLabel4 = new JLabel(); jLabel4.setIcon(new ImageIcon(getClass().getResource( "/shapes/squarehole.png"))); jLabel4.setBounds(new Rectangle(160,25, 52, 50)); jLabel3 = new JLabel(); jLabel3.setIcon(new ImageIcon(getClass().getResource( "/shapes/Tshape.png"))); jLabel3.setBounds(new Rectangle(60, 26, 50, 49)); jLabel2 = new JLabel(); jLabel2.setText("Cross-sectional area of the beam"); jLabel2.setForeground(new Color(51, 0, 0)); jLabel2.setBackground(new Color(102, 0, 0)); jLabel2.setBounds(new Rectangle(247, 4, 189, 25)); jPanel1 = new JPanel(); jPanel1.setLayout(null); jPanel1.setBounds(new Rectangle(10, 50, 650, 85)); jPanel1.setBackground(Color.lightGray); jPanel1.add(jLabel2, null); jPanel1.add(getJRadioButton(), null); jPanel1.add(getJRadioButton1(), null); jPanel1.add(getJRadioButton2(), null); jPanel1.add(getJRadioButton3(), null); jPanel1.add(getJRadioButton4(), null); jPanel1.add(getJRadioButton5(), null); A.add(jRadioButton); A.add(jRadioButton1); A.add(jRadioButton2); A.add(jRadioButton3); A.add(jRadioButton4); A.add(jRadioButton5); jPanel1.add(jLabel3, null); jPanel1.add(jLabel4, null); jPanel1.add(jLabel5, null); jPanel1.add(jLabel6, null); jPanel1.add(jLabel7, null); jPanel1.add(jLabel8, null); } return jPanel1; } /** * This method initializes jRadioButton * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton() { if (jRadioButton == null) { jRadioButton = new JRadioButton(); jRadioButton.setBounds(new Rectangle(20, 35, 20, 20)); jRadioButton.setBackground(new Color(102, 0, 0)); jRadioButton.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { clearSpinnerValue(); jLabel10.setIcon(new ImageIcon(getClass().getResource( "/shapes/Twithlabel.png"))); jLabel11.setVisible(true); jLabel11.setText("B="); jLabel12.setVisible(true); jLabel12.setText("b="); jLabel13.setVisible(true); input1.setVisible(true); input2.setVisible(true); input3.setVisible(true); input4.setVisible(true); input5.setVisible(true); jLabel13.setText("H="); jLabel14.setVisible(true); jLabel14.setText("h="); jLabel76.setVisible(true); jLabel76.setText("d="); jLabel10.setVisible(true); jLabel67.setText(null); jLabel68.setText(null); jLabel69.setText(null); jLabel53.setIcon(new ImageIcon(getClass().getResource( "/shapes/Tbeam_side.png"))); } }); } return jRadioButton; } /** * This method initializes jRadioButton1 * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton1() { if (jRadioButton1 == null) { jRadioButton1 = new JRadioButton(); jRadioButton1.setBounds(new Rectangle(130, 35, 20, 20)); jRadioButton1.setBackground(new Color(102, 0, 0)); jRadioButton1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { clearSpinnerValue(); jLabel10.setIcon(new ImageIcon(getClass().getResource( "/shapes/squareholewithlabel.png"))); jLabel11.setVisible(true); jLabel11.setText("B="); jLabel12.setVisible(true); jLabel12.setText("D="); jLabel13.setVisible(true); jLabel13.setText("b="); jLabel14.setVisible(true); jLabel14.setText("d="); jLabel10.setVisible(true); input1.setVisible(true); input2.setVisible(true); input3.setVisible(true); input4.setVisible(true); input5.setVisible(false); jLabel76.setVisible(false); jLabel67.setText(null); jLabel68.setText(null); jLabel69.setText(null); jLabel53.setIcon(new ImageIcon(getClass().getResource( "/shapes/rectangle_side.png"))); } }); } return jRadioButton1; } private JRadioButton getJRadioButton2() { if (jRadioButton2 == null) { jRadioButton2 = new JRadioButton(); jRadioButton2.setBounds(new Rectangle(230, 35, 20, 20)); jRadioButton2.setBackground(new Color(102, 0, 0)); jRadioButton2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { clearSpinnerValue(); jLabel10.setIcon(new ImageIcon(getClass().getResource( "/shapes/Iwithlabel.png"))); jLabel11.setVisible(true); jLabel11.setText("B="); jLabel12.setVisible(true); jLabel12.setText("D="); jLabel13.setVisible(true); jLabel13.setText("b="); jLabel14.setVisible(true); jLabel14.setText("d="); input1.setVisible(true); input2.setVisible(true); input3.setVisible(true); input4.setVisible(true); input5.setVisible(false); jLabel76.setVisible(false); jLabel67.setText(null); jLabel68.setText(null); jLabel69.setText(null); jLabel53.setIcon(new ImageIcon(getClass().getResource( "/shapes/Ibeam_side.png"))); } }); } return jRadioButton2; } /** * This method initializes jRadioButton3 * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton3() { if (jRadioButton3 == null) { jRadioButton3 = new JRadioButton(); jRadioButton3.setBounds(new Rectangle(330,35, 20, 20)); jRadioButton3.setBackground(new Color(102, 0, 0)); jRadioButton3.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { clearSpinnerValue(); jLabel10.setIcon(new ImageIcon(getClass().getResource( "/shapes/circlewithlabel.png"))); jLabel11.setVisible(true); jLabel11.setText("D="); jLabel12.setVisible(false); jLabel13.setVisible(false); jLabel14.setVisible(false); input1.setVisible(true); input2.setVisible(false); input3.setVisible(false); input4.setVisible(false); input5.setVisible(false); jLabel76.setVisible(false); jLabel67.setText(null); jLabel68.setText(null); jLabel69.setText(null); jLabel53.setIcon(new ImageIcon(getClass().getResource( "/shapes/rectangle_side.png"))); } }); } return jRadioButton3; } /** * This method initializes jRadioButton4 * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton4() { if (jRadioButton4 == null) { jRadioButton4 = new JRadioButton(); jRadioButton4.setBounds(new Rectangle(430, 35, 20, 20)); jRadioButton4.setBackground(new Color(102, 0, 0)); jRadioButton4.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { clearSpinnerValue(); jLabel10.setIcon(new ImageIcon(getClass().getResource( "/shapes/circleholewithlabel.png"))); jLabel11.setVisible(true); jLabel11.setText("D="); jLabel12.setVisible(true); jLabel12.setText("d="); jLabel13.setVisible(false); jLabel14.setVisible(false); input1.setVisible(true); input2.setVisible(true); input3.setVisible(false); input4.setVisible(false); input5.setVisible(false); jLabel76.setVisible(false); jLabel67.setText(null); jLabel68.setText(null); jLabel69.setText(null); jLabel53.setIcon(new ImageIcon(getClass().getResource( "/shapes/rectangle_side.png"))); } }); } return jRadioButton4; } /** * This method initializes jRadioButton5 * * @return javax.swing.JRadioButton */ private JRadioButton getJRadioButton5() { if (jRadioButton5 == null) { jRadioButton5 = new JRadioButton(); jRadioButton5.setBounds(new Rectangle(530, 35, 20, 20)); jRadioButton5.setBackground(new Color(102, 0, 0)); jRadioButton5.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { clearSpinnerValue(); jLabel10.setIcon(new ImageIcon(getClass().getResource( "/shapes/rectanglewithlabel.png"))); jLabel11.setVisible(true); jLabel11.setText("b="); jLabel12.setVisible(true); jLabel12.setText("d="); jLabel13.setVisible(false); jLabel13.setVisible(false); input1.setVisible(true); input2.setVisible(true); input3.setVisible(false); input4.setVisible(false); input5.setVisible(false); jLabel76.setVisible(false); jLabel67.setText(null); jLabel68.setText(null); jLabel69.setText(null); jLabel53.setIcon(new ImageIcon(getClass().getResource( "/shapes/rectangle_side.png"))); } }); } return jRadioButton5; } /** * This method initializes jPanel2 * * @return javax.swing.JPanel */ private JPanel getJPanel2() { if (jPanel2 == null) { jLabel89 = new JLabel(); jLabel89.setBounds(new Rectangle(295, 170, 40, 20)); jLabel89.setText("mm"); jLabel88 = new JLabel(); jLabel88.setBounds(new Rectangle(295, 140, 40, 20)); jLabel88.setText("mm"); jLabel87 = new JLabel(); jLabel87.setBounds(new Rectangle(295, 110, 40, 20)); jLabel87.setText("mm"); jLabel86 = new JLabel(); jLabel86.setBounds(new Rectangle(295, 80, 40, 20)); jLabel86.setText("mm"); jLabel85 = new JLabel(); jLabel85.setBounds(new Rectangle(295, 50, 40, 20)); jLabel85.setText("mm"); jLabel76 = new JLabel(); jLabel76.setBounds(new Rectangle(220, 170, 50, 20)); jLabel14 = new JLabel(); jLabel14.setBounds(new Rectangle(220, 140, 50, 20)); jLabel13 = new JLabel(); jLabel13.setBounds(new Rectangle(220, 110, 50, 20)); jLabel12 = new JLabel(); jLabel12.setBounds(new Rectangle(220, 80, 50, 20)); jLabel11 = new JLabel(); jLabel11.setBounds(new Rectangle(220, 50, 50, 20)); jLabel10 = new JLabel(); jLabel10.setBounds(new Rectangle(30, 35, 175, 190)); jLabel9 = new JLabel(); jLabel9.setBounds(new Rectangle(150, 8, 70, 25)); jLabel9.setText("Dimensions"); jPanel2 = new JPanel(); jPanel2.setLayout(null); jPanel2.setBounds(new Rectangle(10, 145, 370, 250)); jPanel2.setBackground(Color.lightGray); jPanel2.add(jLabel9, null); jPanel2.add(jLabel10, null); jPanel2.add(jLabel11, null); jPanel2.add(jLabel12, null); jPanel2.add(jLabel13, null); jPanel2.add(jLabel14, null); jPanel2.add(input3, null); jPanel2.add(input2, null); jPanel2.add(input4, null); jPanel2.add(input1, null); jPanel2.add(input5, null); jPanel2.add(jLabel76, null); jPanel2.add(jLabel85, null); jPanel2.add(jLabel86, null); jPanel2.add(jLabel87, null); jPanel2.add(jLabel88, null); jPanel2.add(jLabel89, null); input1.setBounds(new Rectangle(240, 50, 50, 20)); input1.setVisible(false); input2.setBounds(new Rectangle(240, 80, 50, 20)); input2.setVisible(false); input3.setBounds(new Rectangle(240, 110, 50, 20)); input3.setVisible(false); input4.setBounds(new Rectangle(240, 140, 50, 20)); input4.setVisible(false); input5.setBounds(new Rectangle(240, 170, 50, 20)); input5.setVisible(false); input1.addChangeListener(listener); input2.addChangeListener(listener); input3.addChangeListener(listener); input4.addChangeListener(listener); input5.addChangeListener(listener); } return jPanel2; } /** * This method initializes jPanel3 * * @return javax.swing.JPanel */ private JPanel getJPanel3() { if (jPanel3 == null) { jLabel30 = new JLabel(); jLabel30.setBounds(new Rectangle(100, 210, 70, 30)); jLabel30.setIcon(new ImageIcon(getClass().getResource( "/shapes/cantilever2.png"))); jLabel29 = new JLabel(); jLabel29.setBounds(new Rectangle(100, 170, 70, 30)); jLabel29.setIcon(new ImageIcon(getClass().getResource( "/shapes/cantilever.png"))); jLabel28 = new JLabel(); jLabel28.setBounds(new Rectangle(90, 130, 85, 30)); jLabel28.setIcon(new ImageIcon(getClass().getResource( "/shapes/rightfixonemoveable.png"))); jLabel27 = new JLabel(); jLabel27.setBounds(new Rectangle(90, 90, 80, 30)); jLabel27.setIcon(new ImageIcon(getClass().getResource( "/shapes/leftfixonemoveable.png"))); jLabel26 = new JLabel(); jLabel26.setBounds(new Rectangle(90, 50, 80, 30)); jLabel26.setIcon(new ImageIcon(getClass().getResource( "/shapes/2endssupports.png"))); jLabel25 = new JLabel(); jLabel25.setText("Beam Configurations"); jLabel25.setForeground(new Color(102, 0, 0)); jLabel25.setBounds(new Rectangle(70, 10, 120, 25)); jPanel3 = new JPanel(); jPanel3.setLayout(null); jPanel3.setBounds(new Rectangle(398, 145, 262, 250)); jPanel3.setBackground(Color.lightGray); jPanel3.add(getJRadioButton6(), null); jPanel3.add(getJRadioButton7(), null); jPanel3.add(getJRadioButton8(), null); jPanel3.add(getJRadioButton9(), null); jPanel3.add(getJRadioButton10(), null); jPanel3.add(jLabel25, null); jPanel3.add(jLabel26, null); jPanel3.add(jLabel27, null); jPanel3.add(jLabel28, null); jPanel3.add(jLabel29, null); jPanel3.add(jLabel30, null); K.add(jRadioButton6); K.add(jRadioButton7); K.add(jRadioButton8); K.add(jRadioButton9); K.add(jRadioButton10); } return jPanel3; } /** * This method initializes jPanel4 * * @return javax.swing.JPanel */ private JPanel getJPanel4() { if (jPanel4 == null) { jLabel110 = new JLabel(); jLabel110.setBounds(new Rectangle(140, 40, 30, 25)); jLabel110.setText("mm"); jLabel60 = new JLabel(); jLabel60.setBounds(new Rectangle(310, 8, 170, 24)); jLabel60.setForeground(Color.blue); jLabel60.setText("L=length,D=Distance,F=Force"); jLabel23 = new JLabel(); jLabel23.setBounds(new Rectangle(407, 55, 185, 24)); jLabel23.setForeground(Color.blue); jLabel23.setText("*hint- use summation of F or M"); jLabel22 = new JLabel(); jLabel22.setBounds(new Rectangle(170, 55, 187, 22)); jLabel22.setForeground(new Color(102, 0, 0)); jLabel21 = new JLabel(); jLabel21.setBounds(new Rectangle(170, 30, 293, 22)); jLabel21.setForeground(new Color(102, 0, 0)); jLabel21.setText("Distance of the fixed pivot measured from the left="); jLabel59 = new JLabel(); jLabel59.setBounds(new Rectangle(429, 102, 177, 20)); jLabel59.setForeground(Color.blue); jLabel59.setText("*hint- use summation of F or M"); jLabel58 = new JLabel(); jLabel58.setBounds(new Rectangle(170, 100, 213, 22)); jLabel58.setForeground(new Color(102, 0, 0)); jLabel58.setText("Force applied on the moveable pivot="); jLabel57 = new JLabel(); jLabel57.setBounds(new Rectangle(170, 80, 320, 21)); jLabel57.setForeground(new Color(102, 0, 0)); jLabel57.setText("Distance of the moveable pivot measured from the left="); jLabel56 = new JLabel(); jLabel56.setBounds(new Rectangle(5, 40, 95, 25)); jLabel56.setForeground(new Color(102, 0, 0)); jLabel56.setText("Length of beam="); jLabel52 = new JLabel(); jLabel52.setBounds(new Rectangle(145, 315, 15, 20)); jLabel52.setText("D2"); jLabel51 = new JLabel(); jLabel51.setBounds(new Rectangle(70, 315, 15, 20)); jLabel51.setText("L1"); jLabel50 = new JLabel(); jLabel50.setBounds(new Rectangle(107, 286, 113, 20)); jLabel50.setText("Moment at the wall"); jLabel49 = new JLabel(); jLabel49.setBounds(new Rectangle(206, 267, 257, 19)); jLabel49.setForeground(Color.blue); jLabel49.setText("(Pls note that counterclockwise is POSTIVE!)"); jLabel48 = new JLabel(); jLabel48.setBounds(new Rectangle(109, 268, 96, 19)); jLabel48.setForeground(new Color(102, 0, 0)); jLabel48.setFont(new Font("Dialog", Font.BOLD, 14)); jLabel48.setText("Purebending"); jLabel47 = new JLabel(); jLabel47.setBounds(new Rectangle(72, 269, 36, 36)); jLabel47.setIcon(new ImageIcon(getClass().getResource( "/shapes/moment.png"))); jLabel46 = new JLabel(); jLabel46.setBounds(new Rectangle(445, 245, 15, 20)); jLabel46.setText("D2"); jLabel45 = new JLabel(); jLabel45.setBounds(new Rectangle(370, 245, 15, 20)); jLabel45.setText("F2"); jLabel44 = new JLabel(); jLabel44.setBounds(new Rectangle(295, 245, 15, 20)); jLabel44.setText("L2"); jLabel43 = new JLabel(); jLabel43.setBounds(new Rectangle(220, 245, 15, 20)); jLabel43.setText("D1"); jLabel42 = new JLabel(); jLabel42.setBounds(new Rectangle(145, 245, 15, 20)); jLabel42.setText("F1"); jLabel41 = new JLabel(); jLabel41.setBounds(new Rectangle(70, 245, 15, 20)); jLabel41.setText("L1"); jLabel40 = new JLabel(); jLabel40.setBounds(new Rectangle(70, 220, 135, 20)); jLabel40.setText("No. of UDL/UDLs(max 2)"); jLabel39 = new JLabel(); jLabel39.setBounds(new Rectangle(182, 202, 362, 19)); jLabel39.setForeground(Color.blue); jLabel39.setText("(Pls note that distance is measured FROM THE LEFT)"); jLabel38 = new JLabel(); jLabel38.setBounds(new Rectangle(146, 200, 37, 20)); jLabel38.setForeground(new Color(102, 0, 0)); jLabel38.setFont(new Font("Dialog", Font.BOLD, 14)); jLabel38.setText(" UDL"); jLabel37 = new JLabel(); jLabel37.setBounds(new Rectangle(70, 200, 73, 20)); jLabel37.setIcon(new ImageIcon(getClass().getResource( "/shapes/udl.png"))); jLabel36 = new JLabel(); jLabel36.setBounds(new Rectangle(59, 164, 207, 20)); jLabel36.setText("No. of point force/forces(max 3)"); jLabel35 = new JLabel(); jLabel35.setBounds(new Rectangle(71, 119, 30, 45)); jLabel35.setIcon(new ImageIcon(getClass().getResource( "/shapes/pointedforce.png"))); jLabel34 = new JLabel(); jLabel34.setBounds(new Rectangle(179, 147, 300, 15)); jLabel34.setForeground(Color.blue); jLabel34.setText("(Pls note that distance is measured FROM THE LEFT!)"); jLabel33 = new JLabel(); jLabel33.setBounds(new Rectangle(181, 132, 300, 15)); jLabel33.setForeground(Color.blue); jLabel33.setText("(Pls note that force pointing UPWARDS IS POSTIVE!)"); jLabel32 = new JLabel(); jLabel32.setBounds(new Rectangle(99, 137, 80, 25)); jLabel32.setText(" Point load"); jLabel32.setFont(new Font("Dialog", Font.BOLD, 14)); jLabel32.setForeground(new Color(102, 0, 0)); jLabel31 = new JLabel(); jLabel31.setBounds(new Rectangle(150, 5, 160, 30)); jLabel31.setText("Type of forces applied"); jLabel31.setFont(new Font("Dialog", Font.BOLD, 14)); jLabel31.setForeground(new Color(102, 0, 0)); jLabel20 = new JLabel(); jLabel20.setBounds(new Rectangle(540, 180, 15, 20)); jLabel20.setText("F3"); jLabel20.setVisible(false); jLabel19 = new JLabel(); jLabel19.setBounds(new Rectangle(540, 160, 15, 20)); jLabel19.setText("D3"); jLabel19.setVisible(false); jLabel18 = new JLabel(); jLabel18.setBounds(new Rectangle(480, 180, 15, 20)); jLabel18.setText("F2"); jLabel18.setVisible(false); jLabel17 = new JLabel(); jLabel17.setBounds(new Rectangle(480, 160, 15, 20)); jLabel17.setText("D2"); jLabel17.setVisible(false); jLabel16 = new JLabel(); jLabel16.setBounds(new Rectangle(410, 180, 15, 20)); jLabel16.setText("F1"); jLabel16.setVisible(false); jLabel15 = new JLabel(); jLabel15.setBounds(new Rectangle(410, 160, 15, 20)); jLabel15.setText("D1"); jLabel15.setVisible(false); jPanel4 = new JPanel(); jPanel4.setLayout(null); jPanel4.setBounds(new Rectangle(10, 400, 650, 345)); jPanel4.setBackground(Color.lightGray); jPanel4.add(getJTextField(), null); jPanel4.add(getJTextField1(), null); jPanel4.add(getJTextField2(), null); jPanel4.add(getJTextField3(), null); jPanel4.add(getJTextField4(), null); jPanel4.add(getJTextField5(), null); jPanel4.add(getJTextField6(), null); jPanel4.add(jLabel15, null); jPanel4.add(jLabel16, null); jPanel4.add(jLabel17, null); jPanel4.add(jLabel18, null); jPanel4.add(jLabel19, null); jPanel4.add(jLabel20, null); jPanel4.add(jLabel31, null); jPanel4.add(getJRadioButton11(), null); jPanel4.add(getJRadioButton12(), null); jPanel4.add(getJRadioButton13(), null); jPanel4.add(jLabel32, null); jPanel4.add(jLabel33, null); jPanel4.add(jLabel34, null); jPanel4.add(jLabel35, null); jPanel4.add(jLabel36, null); jPanel4.add(jLabel37, null); jPanel4.add(jLabel38, null); jPanel4.add(jLabel39, null); jPanel4.add(jLabel40, null); jPanel4.add(getJTextField11(), null); jPanel4.add(jLabel41, null); jPanel4.add(jLabel42, null); jPanel4.add(jLabel43, null); jPanel4.add(jLabel44, null); jPanel4.add(jLabel45, null); jPanel4.add(jLabel46, null); jPanel4.add(getJTextField12(), null); jPanel4.add(getJTextField13(), null); jPanel4.add(getJTextField14(), null); jPanel4.add(getJTextField15(), null); jPanel4.add(getJTextField16(), null); jPanel4.add(getJTextField17(), null); jPanel4.add(jLabel47, null); jPanel4.add(jLabel48, null); jPanel4.add(jLabel49, null); jPanel4.add(jLabel50, null); jPanel4.add(getJTextField18(), null); jPanel4.add(getJTextField19(), null); jPanel4.add(getJTextField20(), null); jPanel4.add(jLabel51, null); jPanel4.add(jLabel52, null); jPanel4.add(jLabel56, null); jPanel4.add(jLabel57, null); jPanel4.add(jLabel58, null); jPanel4.add(getJTextField21(), null); jPanel4.add(jLabel59, null); jPanel4.add(jLabel21, null); jPanel4.add(jLabel22, null); jPanel4.add(getJTextField7(), null); jPanel4.add(getJTextField8(), null); jPanel4.add(jLabel23, null); jPanel4.add(getJTextField9(), null); jPanel4.add(jLabel60, null); jPanel4.add(getJTextField10(), null); jPanel4.add(jLabel110, null); jLabel33.setVisible(false); jLabel34.setVisible(false); jLabel36.setVisible(false); jLabel39.setVisible(false); jLabel40.setVisible(false); jLabel41.setVisible(false); jLabel42.setVisible(false); jLabel43.setVisible(false); jLabel44.setVisible(false); jLabel45.setVisible(false); jLabel46.setVisible(false); jLabel41.setVisible(false); jLabel42.setVisible(false); jLabel43.setVisible(false); jLabel44.setVisible(false); jLabel45.setVisible(false); jLabel46.setVisible(false); jLabel49.setVisible(false); jLabel50.setVisible(false); jTextField18.setVisible(false); jLabel51.setVisible(false); jLabel52.setVisible(false); jLabel21.setVisible(false); jLabel22.setVisible(false); jLabel57.setVisible(false); jLabel58.setVisible(false); jLabel23.setVisible(false); jLabel59.setVisible(false); jTextField7.setVisible(false); jTextField8.setVisible(false); jTextField9.setVisible(false); jTextField21.setVisible(false); } return jPanel4; } /** * This method initializes jPanel5 * * @return javax.swing.JPanel */ private JPanel getJPanel5() { if (jPanel5 == null) { jLabel78 = new JLabel(); jLabel78.setBounds(new Rectangle(36, 3, 20, 153)); jLabel77 = new JLabel(); jLabel77.setBounds(new Rectangle(509, 3, 23, 154)); jLabel24 = new JLabel(); jLabel24.setBounds(new Rectangle(229, 5, 141, 21)); jLabel24.setText("Free Body diagram(FBD)"); jLabel24.setEnabled(true); jLabel24.setForeground(new Color(102, 0, 0)); jLabel55 = new JLabel(); jLabel55.setBounds(new Rectangle(495, 89, 60, 67)); jLabel54 = new JLabel(); jLabel54.setBounds(new Rectangle(32, 89, 58, 64)); jLabel53 = new JLabel(); jLabel53.setBounds(new Rectangle(46, 33, 487, 93)); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.gridy = 0; jPanel5 = new JPanel(); jPanel5.setLayout(null); jPanel5.setBounds(new Rectangle(680, 15, 580, 160)); jPanel5.setBackground(Color.lightGray); jPanel5.add(getJPanel6(), gridBagConstraints1); jPanel5.add(jLabel53, null); jPanel5.add(jLabel54, null); jPanel5.add(jLabel55, null); jPanel5.add(jLabel24, null); jPanel5.add(jLabel77, null); jPanel5.add(jLabel78, null); jLabel54.setVisible(false); jLabel55.setVisible(false); jLabel77.setVisible(false); jLabel78.setVisible(false); } return jPanel5; } /** * This method initializes jPanel6 * * @return javax.swing.JPanel */ private JPanel getJPanel6() { if (jPanel6 == null) { jPanel6 = new JPanel(); jPanel6.setLayout(new GridBagLayout()); jPanel6.setBackground(Color.lightGray); } return jPanel6; } /** * This method initializes jPanel7 * * @return javax.swing.JPanel */ private JPanel getJPanel7() { if (jPanel7 == null) { jLabel62 = new JLabel(); jLabel62.setBounds(new Rectangle(27, 47, 349, 33)); jLabel62.setForeground(new Color(102, 0, 0)); jLabel62.setText("Calculating maximum bending moment acting on the beam");Last edited by ivy; 03-06-2011 at 09:34 AM.
- 03-06-2011, 09:26 AM #7
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
-------------------------------------------------------------------------Java Code:jLabel61 = new JLabel(); jLabel61.setBounds(new Rectangle(274, 7, 52, 23)); jLabel61.setForeground(new Color(102, 0, 0)); jLabel61.setText("Working"); jPanel7 = new JPanel(); jPanel7.setLayout(null); jPanel7.setBounds(new Rectangle(680, 185, 580, 391)); jPanel7.setBackground(Color.lightGray); jPanel7.add(jLabel61, null); jPanel7.add(jLabel62, null); } return jPanel7; } /** * This method initializes jPanel9 * * @return javax.swing.JPanel */ private JPanel getJPanel9() { if (jPanel9 == null) { jLabel84 = new JLabel(); jLabel84.setBounds(new Rectangle(455, 125, 35, 25)); jLabel84.setText("m"); jLabel83 = new JLabel(); jLabel83.setBounds(new Rectangle(455, 85, 35, 25)); jLabel83.setText("kN"); jLabel82 = new JLabel(); jLabel82.setBounds(new Rectangle(455, 45, 35, 25)); jLabel82.setText("kNm"); jLabel81 = new JLabel(); jLabel81.setBounds(new Rectangle(210, 125, 35, 25)); jLabel81.setText("<html>mm<sup>3</html>"); jLabel80 = new JLabel(); jLabel80.setBounds(new Rectangle(210, 85, 35, 25)); jLabel80.setText("mm"); jLabel79 = new JLabel(); jLabel79.setBounds(new Rectangle(210, 45, 35, 25)); jLabel79.setText("<html>mm<sup>4</html>"); jLabel75 = new JLabel(); jLabel75.setBounds(new Rectangle(420, 125, 65, 25)); jLabel74 = new JLabel(); jLabel74.setBounds(new Rectangle(290, 125, 130, 25)); jLabel74.setForeground(new Color(102, 0, 0)); jLabel74.setText("Length of beam="); jLabel73 = new JLabel(); jLabel73.setBounds(new Rectangle(420, 85, 65, 25)); jLabel72 = new JLabel(); jLabel72.setBounds(new Rectangle(290, 85, 130, 25)); jLabel72.setForeground(new Color(102, 0, 0)); jLabel72.setText("Max normal stress="); jLabel71 = new JLabel(); jLabel71.setBounds(new Rectangle(420, 45, 65, 25)); jLabel70 = new JLabel(); jLabel70.setBounds(new Rectangle(290, 45, 130, 25)); jLabel70.setForeground(new Color(102, 0, 0)); jLabel70.setText("Max bending moment="); jLabel69 = new JLabel(); jLabel69.setBounds(new Rectangle(175, 125, 65, 25)); jLabel68 = new JLabel(); jLabel68.setBounds(new Rectangle(175, 85, 65, 25)); jLabel67 = new JLabel(); jLabel67.setBounds(new Rectangle(175, 45, 65, 25)); jLabel66 = new JLabel(); jLabel66.setBounds(new Rectangle(110, 125, 65, 25)); jLabel66.setForeground(new Color(102, 0, 0)); jLabel66.setText("Value of S="); jLabel65 = new JLabel(); jLabel65.setBounds(new Rectangle(110, 85, 65, 25)); jLabel65.setForeground(new Color(102, 0, 0)); jLabel65.setText("Value of y="); jLabel64 = new JLabel(); jLabel64.setBounds(new Rectangle(110, 45, 65, 25)); jLabel64.setForeground(new Color(102, 0, 0)); jLabel64.setText("Value of I="); jLabel63 = new JLabel(); jLabel63.setBounds(new Rectangle(249, 5, 75, 20)); jLabel63.setForeground(new Color(102, 0, 0)); jLabel63.setText("Calculations"); jPanel9 = new JPanel(); jPanel9.setLayout(null); jPanel9.setBounds(new Rectangle(680, 585, 580, 160)); jPanel9.setBackground(Color.lightGray); jPanel9.add(jLabel63, null); jPanel9.add(jLabel64, null); jPanel9.add(jLabel65, null); jPanel9.add(jLabel66, null); jPanel9.add(jLabel67, null); jPanel9.add(jLabel68, null); jPanel9.add(jLabel69, null); jPanel9.add(jLabel70, null); jPanel9.add(jLabel71, null); jPanel9.add(jLabel72, null); jPanel9.add(jLabel73, null); jPanel9.add(jLabel74, null); jPanel9.add(jLabel75, null); jPanel9.add(jLabel79, null); jPanel9.add(jLabel80, null); jPanel9.add(jLabel81, null); jPanel9.add(jLabel82, null); jPanel9.add(jLabel83, null); jPanel9.add(jLabel84, null); } return jPanel9; } /** * This method initializes jButton * * @return javax.swing.JButton */ private JButton getJButton() { if (jButton == null) { jButton = new JButton(); jButton.setBounds(new Rectangle(531, 4, 130, 40)); jButton.setBackground(Color.yellow); jButton.setText("HOME"); jButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { Firstpage Tut = new Firstpage(home); home.getJDesktopPane().removeAll(); home.getJDesktopPane().add(Tut.getJPanel(),BorderLayout.CENTER); } }); } return jButton; } /** * This method initializes jTextField * * @return javax.swing.JTextField */ private JTextField getJTextField() { if (jTextField == null) { jTextField = new JTextField(); jTextField.setVisible(false); jTextField.setBounds(new Rectangle(246, 163, 55, 20)); jTextField.getDocument().addDocumentListener(new DocumentListener(){public void changedUpdate(DocumentEvent e) { } public void removeUpdate(DocumentEvent e) { } public void insertUpdate(DocumentEvent e) { warn(); } public void warn() { int load = Integer.parseInt(jTextField.getText()); if (load <= 0) { JOptionPane.showMessageDialog(null,"Error: please enter number of load again","ERROR MESSAGE",JOptionPane.ERROR_MESSAGE); }else if (load > 3){ JOptionPane.showMessageDialog(null,"Error: please enter number of load again","ERROR MESSAGE",JOptionPane.ERROR_MESSAGE); }else { if (load == 1){ jLabel15.setVisible(true); jLabel16.setVisible(true); jTextField1.setVisible(true); jTextField2.setVisible(true); jLabel17.setVisible(false); jLabel18.setVisible(false); jTextField3.setVisible(false); jTextField4.setVisible(false); jLabel19.setVisible(false); jLabel20.setVisible(false); jTextField5.setVisible(false); jTextField6.setVisible(false); }else if(load ==2){ jLabel15.setVisible(true); jLabel16.setVisible(true); jTextField1.setVisible(true); jTextField2.setVisible(true); jLabel17.setVisible(true); jLabel18.setVisible(true); jTextField3.setVisible(true); jTextField4.setVisible(true); jLabel19.setVisible(false); jLabel20.setVisible(false); jTextField5.setVisible(false); jTextField6.setVisible(false); }else if(load==3){ jLabel15.setVisible(true); jLabel16.setVisible(true); jTextField1.setVisible(true); jTextField2.setVisible(true); jLabel17.setVisible(true); jLabel18.setVisible(true); jTextField3.setVisible(true); jTextField4.setVisible(true); jLabel19.setVisible(true); jLabel20.setVisible(true); jTextField5.setVisible(true); jTextField6.setVisible(true); } } } }); } return jTextField; } private JTextField getJTextField1() { if (jTextField1 == null) { jTextField1 = new JTextField(); jTextField1.setBounds(new Rectangle(425, 163, 45, 20)); jTextField1.setVisible(false); } return jTextField1; } private JTextField getJTextField2() { if (jTextField2 == null) { jTextField2 = new JTextField(); jTextField2.setBounds(new Rectangle(425, 182, 45, 20)); jTextField2.setVisible(false); } return jTextField2; } private JTextField getJTextField3() { if (jTextField3 == null) { jTextField3 = new JTextField(); jTextField3.setBounds(new Rectangle(495, 160, 45, 20)); jTextField3.setVisible(false); } return jTextField3; } private JTextField getJTextField4() { if (jTextField4 == null) { jTextField4 = new JTextField(); jTextField4.setBounds(new Rectangle(495, 180, 45, 20)); jTextField4.setVisible(false); } return jTextField4; } private JTextField getJTextField5() { if (jTextField5 == null) { jTextField5 = new JTextField(); jTextField5.setBounds(new Rectangle(555, 160, 45, 20)); jTextField5.setVisible(false); } return jTextField5; } private JTextField getJTextField6() { if (jTextField6 == null) { jTextField6 = new JTextField(); jTextField6.setBounds(new Rectangle(555, 180, 45, 20)); jTextField6.setVisible(false); } return jTextField6; } private JRadioButton getJRadioButton6() { if (jRadioButton6 == null) { jRadioButton6 = new JRadioButton(); jRadioButton6.setBounds(new Rectangle(50, 50, 20, 20)); jRadioButton6.setBackground(new Color(102, 0, 0)); jRadioButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel54.setVisible(true); jLabel55.setVisible(true); jLabel54.setIcon(new ImageIcon(getClass().getResource( "/shapes/uparrow.png"))); jLabel55.setIcon(new ImageIcon(getClass().getResource( "/shapes/uparrow.png"))); jLabel21.setVisible(true); jLabel22.setVisible(true); jLabel57.setVisible(true); jLabel58.setVisible(true); jLabel55.setVisible(true); jLabel21.setText("Distance of the fixed pivot measured from the left="); jLabel22.setText("Force applied on the fixed pivot="); jLabel57.setText("Distance of the fixed pivot measured from the left="); jLabel58.setText("Force applied on the fixed pivot="); jLabel23.setVisible(true); jLabel59.setVisible(true); jTextField7.setVisible(true); jTextField8.setVisible(true); jTextField9.setVisible(true); jTextField21.setVisible(true); jLabel77.setVisible(false); jLabel78.setVisible(false); } }); } return jRadioButton6; } private JRadioButton getJRadioButton7() { if (jRadioButton7 == null) { jRadioButton7 = new JRadioButton(); jRadioButton7.setBounds(new Rectangle(50, 90, 20, 20)); jRadioButton7.setBackground(new Color(102, 0, 0)); jRadioButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel54.setVisible(true); jLabel55.setVisible(false); jLabel54.setIcon(new ImageIcon(getClass().getResource( "/shapes/uparrow.png"))); jLabel21.setVisible(true); jLabel22.setVisible(true); jLabel57.setVisible(true); jLabel58.setVisible(true); jLabel21.setText("Distance of the fixed pivot measured from the left="); jLabel22.setText("Force applied on the fixed pivot="); jLabel57.setText("Distance of the moveable pivot measured from the left="); jLabel58.setText("Force applied on the moveable pivot="); jLabel23.setVisible(true); jLabel59.setVisible(true); jTextField7.setVisible(true); jTextField8.setVisible(true); jTextField9.setVisible(true); jTextField21.setVisible(true); jLabel77.setVisible(false); jLabel78.setVisible(false); } }); } return jRadioButton7; } private JRadioButton getJRadioButton8() { if (jRadioButton8 == null) { jRadioButton8 = new JRadioButton(); jRadioButton8.setBounds(new Rectangle(50, 130, 20, 20)); jRadioButton8.setBackground(new Color(102, 0, 0)); jRadioButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel54.setVisible(false); jLabel55.setVisible(true); jLabel55.setIcon(new ImageIcon(getClass().getResource( "/shapes/uparrow.png"))); jLabel21.setVisible(true); jLabel22.setVisible(true); jLabel57.setVisible(true); jLabel58.setVisible(true); jLabel55.setVisible(true); jLabel21.setText("Distance of the fixed pivot measured from the left="); jLabel22.setText("Force applied on the fixed pivot="); jLabel57.setText("Distance of the moveable pivot measured from the left="); jLabel58.setText("Force applied on the moveable pivot="); jLabel23.setVisible(true); jLabel59.setVisible(true); jTextField7.setVisible(true); jTextField8.setVisible(true); jTextField9.setVisible(true); jTextField21.setVisible(true); jLabel77.setVisible(false); jLabel78.setVisible(false); } }); } return jRadioButton8; } private JRadioButton getJRadioButton9() { if (jRadioButton9 == null) { jRadioButton9 = new JRadioButton(); jRadioButton9.setBounds(new Rectangle(50, 170, 20, 20)); jRadioButton9.setBackground(new Color(102, 0, 0)); jRadioButton9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel54.setVisible(false); jLabel55.setVisible(false); jLabel21.setVisible(false); jLabel22.setVisible(false); jLabel57.setVisible(false); jLabel58.setVisible(false); jLabel23.setVisible(false); jLabel59.setVisible(false); jTextField7.setVisible(false); jTextField8.setVisible(false); jTextField9.setVisible(false); jTextField21.setVisible(false); jLabel77.setVisible(true); jLabel77.setIcon(new ImageIcon(getClass().getResource( "/shapes/wall.png"))); jLabel78.setVisible(false); } }); } return jRadioButton9; } private JRadioButton getJRadioButton10() { if (jRadioButton10 == null) { jRadioButton10 = new JRadioButton(); jRadioButton10.setBounds(new Rectangle(50, 210, 20, 20)); jRadioButton10.setBackground(new Color(102, 0, 0)); jRadioButton10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel54.setVisible(false); jLabel55.setVisible(false); jLabel21.setVisible(false); jLabel22.setVisible(false); jLabel57.setVisible(false); jLabel58.setVisible(false); jLabel23.setVisible(false); jLabel59.setVisible(false); jTextField7.setVisible(false); jTextField8.setVisible(false); jTextField9.setVisible(false); jTextField21.setVisible(false); jLabel78.setIcon(new ImageIcon(getClass().getResource( "/shapes/wall.png"))); jLabel78.setVisible(true); jLabel77.setVisible(false); } }); } return jRadioButton10; } private JRadioButton getJRadioButton11() { if (jRadioButton11 == null) { jRadioButton11 = new JRadioButton(); jRadioButton11.setBounds(new Rectangle(41, 127, 20, 20)); jRadioButton11.setBackground(new Color(102, 0, 0)); jRadioButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel33.setVisible(true); jLabel34.setVisible(true); jLabel36.setVisible(true); jTextField.setVisible(true); } }); } return jRadioButton11; } private JRadioButton getJRadioButton12() { if (jRadioButton12 == null) { jRadioButton12 = new JRadioButton(); jRadioButton12.setBounds(new Rectangle(40, 200, 20, 20)); jRadioButton12.setBackground(new Color(102, 0, 0)); jRadioButton12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel39.setVisible(true); jLabel40.setVisible(true); jTextField11.setVisible(true); } }); } return jRadioButton12; } private JRadioButton getJRadioButton13() { if (jRadioButton13 == null) { jRadioButton13 = new JRadioButton(); jRadioButton13.setBounds(new Rectangle(40, 270, 20, 20)); jRadioButton13.setBackground(new Color(102, 0, 0)); jRadioButton13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel49.setVisible(true); jLabel50.setVisible(true); jLabel51.setVisible(true); jLabel52.setVisible(true); jTextField18.setVisible(true); jTextField19.setVisible(true); jTextField20.setVisible(true); } }); } return jRadioButton13; } private JTextField getJTextField11() { if (jTextField11 == null) { jTextField11 = new JTextField(); jTextField11.setBounds(new Rectangle(204, 221, 45, 20)); jTextField11.setVisible(false); jTextField11.getDocument().addDocumentListener(new DocumentListener(){public void changedUpdate(DocumentEvent e) { } public void removeUpdate(DocumentEvent e) { } public void insertUpdate(DocumentEvent e) { warn(); } public void warn() { int load = Integer.parseInt(jTextField11.getText()); if (load <= 0) { JOptionPane.showMessageDialog(null,"Error: please enter number of load again","ERROR MESSAGE",JOptionPane.ERROR_MESSAGE); }else if (load > 2){ JOptionPane.showMessageDialog(null,"Error: please enter number of load again","ERROR MESSAGE",JOptionPane.ERROR_MESSAGE); }else { if (load == 1){ jLabel41.setVisible(true); jLabel42.setVisible(true); jLabel43.setVisible(true); jTextField12.setVisible(true); jTextField14.setVisible(true); jTextField16.setVisible(true); jLabel44.setVisible(false); jLabel45.setVisible(false); jLabel46.setVisible(false); jTextField13.setVisible(false); jTextField15.setVisible(false); jTextField17.setVisible(false); }else if(load ==2){ jLabel41.setVisible(true); jLabel42.setVisible(true); jLabel43.setVisible(true); jTextField12.setVisible(true); jTextField14.setVisible(true); jTextField16.setVisible(true); jLabel44.setVisible(true); jLabel45.setVisible(true); jLabel46.setVisible(true); jTextField13.setVisible(true); jTextField15.setVisible(true); jTextField17.setVisible(true); } } } }); } return jTextField11; } private JTextField getJTextField12() { if (jTextField12 == null) { jTextField12 = new JTextField(); jTextField12.setBounds(new Rectangle(85, 245, 45, 20)); jTextField12.setVisible(false); } return jTextField12; } private JTextField getJTextField13() { if (jTextField13 == null) { jTextField13 = new JTextField(); jTextField13.setBounds(new Rectangle(310, 245, 45, 20)); jTextField13.setVisible(false); } return jTextField13; } private JTextField getJTextField14() { if (jTextField14 == null) { jTextField14 = new JTextField(); jTextField14.setBounds(new Rectangle(160, 245, 45, 20)); jTextField14.setVisible(false); } return jTextField14; } private JTextField getJTextField15() { if (jTextField15 == null) { jTextField15 = new JTextField(); jTextField15.setBounds(new Rectangle(385, 245, 45, 20)); jTextField15.setVisible(false); } return jTextField15; } private JTextField getJTextField16() { if (jTextField16 == null) { jTextField16 = new JTextField(); jTextField16.setBounds(new Rectangle(235, 245, 45, 20)); jTextField16.setVisible(false); } return jTextField16; } private JTextField getJTextField17() { if (jTextField17 == null) { jTextField17 = new JTextField(); jTextField17.setBounds(new Rectangle(460, 245, 45, 20)); jTextField17.setVisible(false); } return jTextField17; } /** * This method initializes jTextField18 * * @return javax.swing.JTextField */ private JTextField getJTextField18() { if (jTextField18 == null) { jTextField18 = new JTextField(); jTextField18.setVisible(false); jTextField18.setBounds(new Rectangle(220, 287, 45, 20)); } return jTextField18; } private JTextField getJTextField19() { if (jTextField19 == null) { jTextField19 = new JTextField(); jTextField19.setVisible(false); jTextField19.setBounds(new Rectangle(85, 315, 45, 20)); } return jTextField19; } private JTextField getJTextField20() { if (jTextField20 == null) { jTextField20 = new JTextField(); jTextField20.setVisible(false); jTextField20.setBounds(new Rectangle(160, 315, 45, 20)); } return jTextField20; } private JTextField getJTextField21() { if (jTextField21 == null) { jTextField21 = new JTextField(); jTextField21.setBounds(new Rectangle(384, 100, 45, 20)); } return jTextField21; } private JTextField getJTextField7() { if (jTextField7 == null) { jTextField7 = new JTextField(); jTextField7.setBounds(new Rectangle(465,30, 52, 23)); } return jTextField7; } private JTextField getJTextField8() { if (jTextField8 == null) { jTextField8 = new JTextField(); jTextField8.setBounds(new Rectangle(359, 55, 48, 25)); } return jTextField8; } private JTextField getJTextField9() { if (jTextField9 == null) { jTextField9 = new JTextField(); jTextField9.setBounds(new Rectangle(491, 80, 45, 20)); } return jTextField9; } ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent e) { double value = 0.0; // @jve:decl-index=0: double value1 = 0.0; double value2 = 0.0; if (getJRadioButton5().isSelected()) { double b = ((Double) input1.getValue()).doubleValue(); double d = ((Double) input2.getValue()).doubleValue(); if (b != 0 && d != 0) { value = Formula.calculateMOI1(b, d); jLabel67.setText(df.format(value)); value1 = Formula.calculateY1(d); jLabel68.setText(df.format(value1)); value2 = Formula.calculateS1(value,value1); jLabel69.setText(df.format(value2)); } }else if (getJRadioButton3().isSelected()) { double D = ((Double) input1.getValue()).doubleValue(); if (D != 0) { value = Formula.calculateMOI2(D); jLabel67.setText(df.format(value)); value1 = Formula.calculateY2(D); jLabel68.setText(df.format(value1)); value2 = Formula.calculateS2(value,value1); jLabel69.setText(df.format(value2)); } }else if (getJRadioButton4().isSelected()){ double D = ((Double) input1.getValue()).doubleValue(); double d = ((Double) input2.getValue()).doubleValue(); if (D != 0 && d != 0) { value = Formula.calculateMOI4(D, d); jLabel67.setText(df.format(value)); value1 = Formula.calculateY4(D); jLabel68.setText(df.format(value1)); value2 = Formula.calculateS4(value,value1); jLabel69.setText(df.format(value2)); } }else if (getJRadioButton2().isSelected()){ double B = ((Double) input1.getValue()).doubleValue(); double D = ((Double) input2.getValue()).doubleValue(); double b = ((Double) input3.getValue()).doubleValue(); double d = ((Double) input4.getValue()).doubleValue(); if (B != 0 && D != 0 && b != 0 && d != 0) { value = Formula.calculateMOI5(B, D, b, d); jLabel67.setText(df.format(value)); value1 = Formula.calculateY5(D); jLabel68.setText(df.format(value1)); value2 = Formula.calculateS5(value,value1); jLabel69.setText(df.format(value2)); } }else if (getJRadioButton().isSelected()){ double B = ((Double) input1.getValue()).doubleValue(); double b = ((Double) input2.getValue()).doubleValue(); double H = ((Double) input3.getValue()).doubleValue(); double h = ((Double) input4.getValue()).doubleValue(); double d = ((Double) input5.getValue()).doubleValue(); if (B != 0 && b != 0 && H != 0 && h != 0 && d != 0) { value = Formula.calculateMOI7(B,b,H,h,d); jLabel67.setText(df.format(value)); value1 = Formula.calculateY7(B,b,H,h,d); jLabel68.setText(df.format(value1)); value2 = Formula.calculateS7(value,value1); jLabel69.setText(df.format(value2)); } }else if (getJRadioButton1().isSelected()){ double B = ((Double) input1.getValue()).doubleValue(); double D = ((Double) input2.getValue()).doubleValue(); double b = ((Double) input3.getValue()).doubleValue(); double d = ((Double) input4.getValue()).doubleValue(); if (B != 0 && D != 0 && b != 0 && d != 0) { value = Formula.calculateMOI6(B, D, b, d); jLabel67.setText(df.format(value)); value1 = Formula.calculateY6(D); jLabel68.setText(df.format(value1)); value2 = Formula.calculateS6(value,value1); jLabel69.setText(df.format(value2)); } } } }; private JTextField jTextField10 = null; private JLabel jLabel77 = null; private JLabel jLabel78 = null; private JLabel jLabel79 = null; private JLabel jLabel80 = null; private JLabel jLabel81 = null; private JLabel jLabel82 = null; private JLabel jLabel83 = null; private JLabel jLabel84 = null; private JLabel jLabel85 = null; private JLabel jLabel86 = null; private JLabel jLabel87 = null; private JLabel jLabel88 = null; private JLabel jLabel89 = null; private JLabel jLabel110 = null; /** * This method initializes jTextField10 * * @return javax.swing.JTextField */ private JTextField getJTextField10() { if (jTextField10 == null) { jTextField10 = new JTextField(); jTextField10.setBounds(new Rectangle(100, 40, 40, 25)); jTextField10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jLabel75.setVisible(true);} }); } return jTextField10; } }
can you kindly help me check what is wrong. thanks!Last edited by ivy; 03-06-2011 at 09:35 AM.
- 03-06-2011, 09:30 AM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Do you seriously expect us to read such a big blob of unformatted code? Please add a [code] tag just before the start of your code and put a [/code] tag after the end of your code (edit your original replies and please don't throw that huge blob of code at us again).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-06-2011, 09:36 AM #9
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
I am sorry.
Is this what i am supposed to do?
thanks
- 03-06-2011, 10:28 AM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-06-2011, 03:28 PM #11
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
We can't check your project like this.
Make another sample code to execute your main problem.we will check that.
- 03-06-2011, 04:13 PM #12
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
Hi,
i have already solved tat problem. thanks
I got some maths coding to ask..
For example,
f1=2
d1=5
f2=4
d2=7
f3=????
d3=10
This is the formula i need to input=>(f1xd1)+(f2xd2)+(f3xd3)=0 (Equate everything equal to zero)
=> (2x5)+(4x7)+(f3x10)=0
=> f3=? (I need to get this answer)
How do i write this codings?
hope to get a reply soon.
thanks!
- 03-06-2011, 04:21 PM #13
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
I think its simple
in f3 you will get the resultJava Code:double f3=(-1)((f1xd1)+(f2xd2))/d3;
- 03-23-2011, 04:28 AM #14
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
audio in java eclipse?
how to import audio into my program?
the user will click on the jButton, then the audio start playing...
- 03-23-2011, 05:54 AM #15
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
See books or google. There are lots of example of it.
If you are unexperienced in google searching
Search in google writingJavaAudioPlaySoundExample
- 03-25-2011, 07:52 PM #16
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
maths problem
Hi there,
I dunno what is wrong with my program. when i input F1=2, D1=5,the rest assume to be zero.
i will get 0.0 for my "Maxbending_pointload_and_cantilever1"
may i know what is wrong?
this is my formulaJava Code:KeyListener listener1 = new KeyAdapter() { public void keyReleased(KeyEvent e) { double F1 = 0.0; // @jve:decl-index=0: double F2 = 0.0; double F3 = 0.0; double D1 = 0.0; // @jve:decl-index=0: double D2 = 0.0; double D3 = 0.0; if (getJRadioButton9().isSelected() && getJRadioButton11().isSelected() != getJRadioButton7().isSelected()!= getJRadioButton6().isSelected()!= getJRadioButton12().isSelected()!= getJRadioButton13().isSelected()) { if(!getF2().getText().equals("")){ F2 = (Double.parseDouble(getF2().getText())); } if(!getD2().getText().equals("")){ D2 = (Double.parseDouble(getD2().getText())); } if(!getF3().getText().equals("")){ F3 = (Double.parseDouble(getF3().getText())); } if(!getD3().getText().equals("")){ D3 = (Double.parseDouble(getD3().getText())); } if(!getF1().getText().equals("")){ F1 = (Double.parseDouble(getF1().getText())); } if(!getD1().getText().equals("")){ D1 = (Double.parseDouble(getD1().getText())); } double result1 = Formula.P1_pointload_and_cantilever1(F1,F2,F3); jLabel19.setText(""+result1); double result2 = Formula.Maxbending_pointload_and_cantilever1(F1,F2,F3,D1,D2,D3); jLabel22.setText(""+(result2)); jLabel37.setText(""+(Math.abs(result2))); }
Java Code:public static double P1_pointload_and_cantilever1(double F1, double F2, double F3 ) { return(F3+F2+F1) ; } //this is the Max bending public static double Maxbending_pointload_and_cantilever1(double F1, double F2, double F3, double D2, double D1, double D3 ) { return((F1*D1)+(F2*D2)+(F3*D3)) ; }
- 03-26-2011, 07:36 AM #17
Member
- Join Date
- Jan 2011
- Posts
- 13
- Rep Power
- 0
another maths problem
Hi there, i have solved my previous problem. But now i got another problem. i dunno why nth is display.
this is my code. thanks!
this is my formula codeJava Code:KeyListener listener1 = new KeyAdapter() { public void keyReleased(KeyEvent e) { double L = 0.0; double x = 0.0; double W = 0.0; double a = 0.0; boolean aentered = false; if(!getA().getText().isEmpty()){ aentered = true; a=Double.parseDouble(getA().getText()); } if (getJRadioButton6().isSelected() && getJRadioButton12().isSelected() && aentered==true &! getJRadioButton7().isSelected()&! getJRadioButton9().isSelected()&! getJRadioButton11().isSelected()&! getJRadioButton13().isSelected()) { if( a==0 ){ if(!getW().getText().equals("")){ W = (Double.parseDouble(getW().getText())); } if(!getX().getText().equals("")){ x = (Double.parseDouble(getX().getText())); } if(!getL().getText().equals("")){ L = (Double.parseDouble(getL().getText())); } if(!getA().getText().equals("")){ a = (Double.parseDouble(getA().getText())); } double result1 = Formula.P1_UDL1_and_twofixed(W,x,L); jLabel19.setText(""+result1); double result2 = Formula.P2_UDL1_and_twofixed(W,x,result1); jLabel22.setText(""+result2); double MP = Formula.MP_UDL1_and_twofixed(W,result2); double moment1 = Formula.MaxBending_UDL1_and_twofixed(W,result2,MP); jLabel37.setText(""+(Math.abs(moment1))); }}
Java Code:public static double P1_UDL1_and_twofixed(double W, double x, double L ) { return(((W*x*x/2)/L)) ; } public static double P2_UDL1_and_twofixed(double W, double x,double P1_UDL1_and_twofixed ) { return((W*x)-P1_UDL1_and_twofixed) ; } public static double MP_UDL1_and_twofixed(double W, double P2_UDL1_and_twofixed ) { return(P2_UDL1_and_twofixed/W) ; } //this is the Max Bending public static double MaxBending_UDL1_and_twofixed(double W, double P2_UDL1_and_twofixed, double MP_UDL1_and_twofixed ) { return((-(W/2)*(MP_UDL1_and_twofixed*MP_UDL1_and_twofixed))+(P2_UDL1_and_twofixed*MP_UDL1_and_twofixed)) ; }
Similar Threads
-
changing my program to array working program
By Chewart in forum New To JavaReplies: 39Last Post: 11-18-2009, 06:53 PM -
Execute A program from a Program!
By Moncleared in forum Advanced JavaReplies: 2Last Post: 02-22-2009, 04:17 PM -
Executing a program within a program
By gibsonrocker800 in forum New To JavaReplies: 5Last Post: 05-12-2008, 08:24 AM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:40 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks