Rene Liebmann

Ranch Hand
+ Follow
since May 02, 2002
Merit badge: grant badges
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rene Liebmann

Why do you paint the image by yourself? If this is the only thing, then you could use a JLabel too. There you can set an image.
But anyway, in order to get the image painted correctly, you need to set a size and a preferred size of the panel, which you are using to display the image. You need to calculate this from the image size. I think, if you do this, then your panel will be larger.
21 years ago
Why you don't remember the last selected Tab? For the first time, it is up to you to set a Tab. So maybe the last Tab is -1. Then when your event is fired, you can do whatever you want with the information of the last tab. After this, you set the last tab to the current one. This is the most simple thing, which comes into my mind.
21 years ago
JAI has it's homepage under JAI home
There you can find JAI itself and some tutorials and demos.
21 years ago
I do not know, if this is possible. Probably not. If you want to change something with your image, then you should have a look on JAI Java Advanced Imaging. They can do a lot. It is a good API.
21 years ago
I found the problem: In your main class TestFrame, you overwrite the paint-method. If you comment this method out, then all components will be displayed correctly.
21 years ago
I did a lot with JTrees and at least for me it was enough to extend form DefaultTreeModel and to fill the model with DefaultMutableTreeNodes. The DefaultMutableTreeNode has an UserObject. There you can put in any Object, you need. It should simply implement a toString method for displaying. I think, this is the reason, why DefaultMutableTreeNodes are a good choice.
21 years ago
I think, you have to take a closer look to JAI (Java Advanced Imaging). I'm shure, that this kind of behaviour is possible with that API.
21 years ago
Yes, you have to use DateFormat or better SimpleDateFormat to be able to parse your input and to get a Date. This Date you can put into a Calendar, which has the function getTimeInMillis(). This you have to do for both date values.
It is easy to substract both millis and to calculate seconds from it.
This sounds a bit strange, but in fact it will be not more than 20 lines of code or maybe less. Even much better, than calculating all by yourself.
21 years ago
How do you take the values? Do you have a TableModel behind? Can you post some simple code? Do you use your own TableCellEditor? If yes, you could work with the FocusLost event. There you can set your model. What happens if you press Return after your last input?
21 years ago
I would take Swing and I would make a JavaBean. Then you have the chance to decide later if you want to create an application or a game for everyone inside an applet.
21 years ago
The itemStateChanged event of the JComboBox is fired two times, first when the old selected entry is deselected and then when the new entry is selected. If you catch the actionperformed event then you will get only one event, just when the new selection is made and only then. If you decide to select the old value again, no event will be fired.
21 years ago
Yes, why not. Everything is possible! TableCellRenderer is the solution. Just try it!
21 years ago
You have to implement your own TableCellRenderer.
in the method getTableCellRendererComponent you can return your Timer. But please have in mind, that you have to handle the selection stuff (background and foreground color). If you don't handle this, it might look a bit strange.
21 years ago
Why you don't make ClassA and ClassB extending from JComponent and you wrap it by one JFrame. Then it is easy to display CalssA in the JFrame and it is also easy to change the contents of the JFrame by destoying it and adding ClassB.
Do you got the idea?
21 years ago
If you want to do this, you need ScrollBars. AWT has also a ScrollPane (java.awt.ScrollPane). Try to have a look there.
21 years ago