Ok, im a begginer and im having trouble using the drawstring method... i get no error when compiling and no error in the console when running the only problem is that my string doesnt show.... i simply get my blank frame with no string showing... heres my code:
and in my other class :Code:public class Main extends Class1 { public static void main (String args[]) { new Main(); } public static void println(String s) { System.out.println(s); } public void method1(int x, int y, boolean bool, boolean b, String s) { frame.setSize(x,y); frame.setVisible(bool); frame.setResizable(b); frame.setTitle(s); println("Frame Loaded Sucessfully"); } public Main() { method1(800,500,true,false,"In search of a name"); method2(50,50,"enfin"); } }
If you got any idea why my string aint showing please tell me... is there a method like .setVisible(true); that i have to add or something?Code:import java.awt.Frame; import java.awt.*; import java.applet.Applet; import javax.swing.JTextField; public abstract class Class1 { Frame frame = new Frame(); public void method2(int x, int y, String s) { frame.getGraphics().drawString(s,x,y); frame.repaint(); } }
Thanks you![]()


Reply With Quote



Bookmarks