java amateur
java amateur
Rob Camick wrote:
(...)
Or you could also use JLayeredPanes. One layer for the image and one the the panel with your custom painting. The Swing tutorial has a section on "How to Use Layered Panes".
java amateur
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
java amateur
pete stein wrote:What the heck...
(...)
It doesn't do what you want, but it does illustrate somewhat how to show graphics in background panels and draw on the top. I'm no pro at this, so corrections most welcome.
java amateur
miguel lisboa wrote:
pete stein wrote:What the heck...
(...)
It doesn't do what you want, but it does illustrate somewhat how to show graphics in background panels and draw on the top. I'm no pro at this, so corrections most welcome.
your code wont compile![]()
java amateur
java amateur
java amateur
when implementing this feature in my real code i came across several dificulties
Rob Camick wrote:
So where is your SSCCE? What you posted is NOT a SSCCE. For one thing it does not compile. All you did was take code from your real project and post it on the forum.(...).
Rob Camick wrote:As I understand the problem you are trying to add a scrollpane to a layered pane and get it to scroll
java amateur
the code i posted is a ss (not from my real aplication!) - what i did was just posting the class i changed - the others remain equal
java amateur
java amateur
an image is worth a thousand words
Rob Camick wrote:
an image is worth a thousand words
No a proper SSCCE is worth a thousand words and since you haven't posted one (a proper SSCCE) I have nothing to say.
java amateur
java amateur
java amateur
you never explained why i cant get the picture displayed...
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
miguel lisboa wrote:you never explained why i cant get the picture displayed...
java amateur
miguel lisboa wrote:@ pete
you made an good point, thank you
pete stein wrote:
miguel lisboa wrote:@ pete
you made an good point, thank you
You're welcome, but note that of the points that I made, one (that you should use layouts) was first made by rob, and the another two (to use public images and brief code in your SSCCE) is part of the SSCCE specification that you've been advised to read. Again, the link is here:
http://sscce.org
java amateur
Rob Camick wrote:Even with the null layout it was only a sinlge line change to get the image to display. And the updated code Pete provided still has the problem that caused the null layout to not display the image.
Rob Camick wrote:
Yet again, the answer gets spoon fed and the real problem (with the posted code) doesn't get solved. The exact same problem occurred in the other posting I referred to.
Rob Camick wrote: How will the OP get practice writing code with layout managers when we write the code for him. If the OP doesn't understand the current problem then he won't understand how layout managers will benefit him in the long run.
Its extremely frustrating to spend all the time trying to teach some basic problem solving skills, how to create a SSCCE etc, etc only to see all my time and effort wasted.
java amateur
its in such a cryptic way that still doesnt help at all
i still cant understand what exactly is the impact of layouts in the code,
now imagine my frustration to see all my time and effort wasted
Rob Camick wrote:
its in such a cryptic way that still doesnt help at all
Did you make the effort to look at the previous posting to see what I said:
there is absolutely no reason to be playing around with the preferred size of the label (especially doing it twice).
How is that cryptic? In this posting I said:
In general, you should never have to play with the preferred sizes of components. Except for maybe container type components like a JScrollPane or JSplitPane.
Again, how is that cryptic. Yes, I could have just commented out the line of code causing the problem,but you don't learn anything that way. This way I took extra time to explain what the problem was and when you should use the method in question.
Rob Camick wrote:
i still cant understand what exactly is the impact of layouts in the code,
Why do you think I keep referring you to the Swing tutorial. Did you download the "How to Use Split Panes" example to play with? Did you look at the layout manager they used? Have you even read the layout manager tuturial? None of you questions are based on information found in the tutorial. So how do we know what your confusion about using layout mangers is? Why do you think our examples will be any better than the examples in the tutorial?
java amateur
miguel lisboa wrote:
so, in a nutshell: no, i dont want to be spoon feeded; i just want the help to say: this is done this way, not that way; to fully understand what i'm telling you you should take a look at this and at that, or: you problem gets more complicated because you'r doing things in a poor way; anyway you have to do this and that; if you want a proper solution then start here, afterwards go there, because... and so on
Michael Dunn wrote:Miguel,
as an 'amused' reader of this thread, I ask you to take a step backwards/sideways, and try to help this (very new) poster.
https://coderanch.com/t/476777/Swing-AWT-SWT-JFace/java/Color-Row-JTable
your options are:
1) copy/paste the posted code, and spend at least an hour (probably more) trying to get an example to compile/run and replicate the problem.
2) ignore the post entirely, because it is a pathetic attempt at getting help
3) tell the poster what he has to do to simplify 'his' problem, so that his 'audience' can easily compile/run/test/post a resolution
(at the time of this post there are only 4 posts to the indicated thread)
personally, I choose (2), Rob Camick has a lot more patience than I, so he chooses (3),
in the hope that the poster with the problem will learn some self-help problem solving skills.
anyway, try to help the person in the indicated thread, and see it the same way Rob Camick sees it.
java amateur
miguel lisboa wrote:
i said somewhere above:
this example describes what those images have shown: if we have a panel added to the splitPane, the scroll gets truncated!
recentering my problem:
i want to be able to draw over this picture which lies inside a splitpane
in order to implement the drawing functionality i have, by force, to have some kind of support (container, or the like) in order to be able to add either the layered pane or the drawingArea object
is there a way out for this?
miguel lisboa wrote:is there a way out for this
Yeah, but is it art? What do you think tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|