Get "Frame"(?) as a methode
Hello all
I'm kind of new to java (kind of, i know the basics by now) :)
Anyway, as our first script in school, we did a "frame" code, that gave out a box with text inside. that was just to see how a code looked like... Now, 1,5 years later, i'm still trying to figure how it works.
Anyway, now i want to implent the old code as a method into another code. Is that possible?
The code (Edited today, with lines i found on internet :p )
Code:
import java.awt.*;
class test2 extends Frame
{
Font f;
Dimension ssize = Toolkit.getDefaultToolkit().getScreenSize();
int x = (int) (ssize.getWidth()) / 2;
int y = (int) (ssize.getHeight()) / 2;
test2() //konstruktor för klassen test2
{
f=new Font("Sansserif",Font.BOLD,100);
setBackground(Color.black);
setSize(x*2, y);
}
public void paint(Graphics g)
{
g.setFont(f);
g.setColor(Color.white);
g.drawString("Vakna", x, y);
}
public static void vakna()
{
test2 t2 = new test2();
t2.setVisible(true);
}
}
Anyone can help me implenitng in into another code?
doesn't seem to be enough
:P
///Mattedatten