thanks everybody, its working now.
I have a new problem.
since there's no command pack for JPanel, how do
I size JPanel so it fits my painting from Graphics method.
Is there some similar command to as pack() for JFrame I could use.
I tried with
without any success.
My class for JPanel looks like this
I dont understand how I can write with the Graphics class on the same JPanel as I use swing components on or should I use different layers and which layers do I need in that case.
Where should my paintComponent method be?, should it be in the same class (MakeGUI) or should I have a class of its own like I have now (PlotGraphics).
Iam a little bit confused about these things
Iam programming a program which shows the current time as an analog clock, which i construct with the graphics class.
My GUI consists of buttons to set time, start clock or timer from the swing components.
Now I have been reading about java graphics class, iam not sure if it is OK to have both the GUI and graphics on the same layer (JPanel)
and where to implement the graphics methods.
Just wanted to say that I managed to get it work.
The compiler wont complain at all if I instantiate by=
JButton button = new JButton();
but if I wright
button = new JButton();
the compiler starts complaining about insert curlybrackets and or missing ;
in the end of line, even if everything is OK.
now I believe there's some bugs on eclipse for ubuntu,
anyone who has experienced something similar?
Thanks for your reply.
I have been trying with the curly brackets also, but it wont compile anyway.
I never needed the curly bracketws before in my programming when declaring an boolean
variable or instantiating JButton's, I believe there has to be some compiler error going on.
Iam quite new to programming, so iam learning a little about OOP in general and started off with java.
I have been doing a program that takes in system time and converts it to analog time which I plot on
the monitor with graphics class and the appropriate functions.
The program is still far away from finished, but i get stucked and don't know how to continue.
there are four different classes:
Frame3 that's my main class.
GraphicsPlot is where I want to plot all the graphics.
MakeGUI from here I make the GUI to control the program flow.
TimeTick handles the Timer and TimerTask, to control the timing.
Iam programming with eclipse on my ubuntu 12.04 and I got various error messages from the IDE
all the time.