• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

java programming help

weezergirl

Diamond Member
blah, i need help guys. here is the code:

public void init() {
Container c = getContentPane();
c.setLayout(new BorderLayout());
//make plot button
labeltop=new JLabel("Y=X*sin(1/(X^A))", JLabel.CENTER);
labelbottom1 = new JLabel(&quot;-10<A<10:&quot;, JLabel.EAST);
labelbottom2 = new JLabel(&quot;0<=maxX:&quot;, JLabel.EAST);
plotbutton=new JButton(&quot;Plot&quot😉;
clearbutton=new JButton(&quot;Clear&quot😉;
text1= new JTextField(&quot;1.0&quot😉;
text1.setHorizontalAlignment(JTextField.CENTER);
text2 = new JTextField(&quot;0.5&quot😉;
text2.setHorizontalAlignment(JTextField.CENTER);

bottompanel = new JPanel(new GridLayout(2,3));
bottompanel.add(plotbutton);
bottompanel.add(labelbottom1);
bottompanel.add(text1);
bottompanel.add(clearbutton);
bottompanel.add(labelbottom2);
bottompanel.add(text2);

c.add(labeltop, &quot;North&quot😉;
c.add(bottompanel, &quot;South&quot😉;
}


for some reason i can't add labelbottom1 and labelbottom2 onto the bottom panel. the program will compile correctly but when i view the applet it says it hasn't been initialized yet?! but when i leave those 2 labels out it works fine. why?!?!?! this is driving me crazy. thanks for any help or suggestions 🙂
 
remove the colons?


<< JLabel(&quot;-10<A<10:&quot;, JLabel.EAST); >>




<< new JLabel(&quot;0<=maxX:&quot;, JLabel.EAST); >>

 
oh actually that was part of the string, but i think i figured it out. it has to do with the EAST. how do u right justify?? i thought it was EAST...oh well let me look it up. '

oh ok. it's right. duhhh. hehe
 
i don't know jack about java, never have drank coffee

figured it was like html and the littles stuff throws it all off
 
I'm taking java programming right now in Grade 12 computer science. Personally, I hate it. It's buggy. We've been spending a whole semester trying to get a couple of balls to bounce around on screen.

Sorry though, I can't help you. Good luck.
 
Back
Top