Tuesday 15 June 2010

java - Why isn't my string being displayed in the window? -


I am trying to create a simple application that shows a red circle when clicked on it Different messages are displayed, I believe this part of the code:

  G. Dre string ("do not press", 100, 100);   

has been correctly coded but no text is displayed on the window that opens. Here's the complete code:

  import java .awt.Graphics; Import javax.swing.JFrame; The public square extends BigReaden Jeffreem (Public Bigread button) (set-title ("Big Red Button"); Set Size (500, 500); setResizable (wrong); setVisible (set); setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);} Public Zero Graphics (Graphics G) {g.drawString ("DO NOT Press", 100, 100);} Public Static Zero Main (String [] Args) {New BigRead ();}}    

  1. There is no such way in graphics JFARAM Something like this I'm not saying that.
  2. Avoid painting straight upper level containers, and occasionally, they do not make double buffer and will not flicker when painted. Instead, you Make a custom component (such as expanding something from JPanel ) and its paintComponent method must be overridden.
  3. Take time to read Besides, during your reading, you should

    modify

    Andrew said, should you read, to make sure that the method you think is overriding, actually that method is being overridden in the first place You must use the @override annotation to make sure it is. This will prevent the program from being compiled and try to save a lot of lost time so that it can be ascertained that the way things are expected of you are not working.

No comments:

Post a Comment