 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andrew Thompson Guest
|
Posted: Wed Nov 29, 2006 8:11 am Post subject: Re: problem with setting a panel size within a frame |
|
|
Adam Sandler wrote:
| Quote: | Andrew Thompson wrote:
....
As a wider question, is this 'Please Wait' message
more suited to a JProgressBar in a floating
JDialog or JOptionPane?
A JProgressBar is very well suited if you have a task where the
duration, or the criteria for finishing a task is known. What about
those times where the completion of a task isn't so clearly known?
|
<http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JProgressBar.html>
"To indicate that a task of unknown length is executing,
you can put a progress bar into indeterminate mode."
Did you even attempt to RTFM?
Andrew T. |
|
| Back to top |
|
 |
ashwinijain Guest
|
Posted: Wed Nov 29, 2006 3:29 pm Post subject: Re: how to print the data with components? |
|
|
Michael Dunn wrote:
| Quote: | I'd post a link, but I had to modify a couple of things to get it to work,
so easier to post the code.
(don't ask me how it works, I have no idea)
Thanks Michael. |
Your code works.
I have one JPanel which is consisting of many swing components like
JTable, JList, JTextField,etc.
So, whenever i am passing that JPanel to constructor of StandardPrint,
multiple copies of Jtable is getting printed on many papers.
Please help me in solving this problem.
public void actionPerformed(ActionEvent e)
{
StandardPrint sp = new StandardPrint(b); // b is the instance of
JPanel.
try{sp.start();}catch(Exception x){}
} |
|
| Back to top |
|
 |
Adam Sandler Guest
|
Posted: Wed Nov 29, 2006 7:17 pm Post subject: Re: problem with setting a panel size within a frame |
|
|
| Quote: | Did you even attempt to RTFM?
|
Thanks for your help thus far. |
|
| Back to top |
|
 |
Michael Dunn Guest
|
Posted: Thu Nov 30, 2006 3:23 am Post subject: Re: how to print the data with components? |
|
|
ashwinijain wrote:
| Quote: | Michael Dunn wrote:
I'd post a link, but I had to modify a couple of things to get it to work,
so easier to post the code.
(don't ask me how it works, I have no idea)
Thanks Michael.
Your code works.
I have one JPanel which is consisting of many swing components like
JTable, JList, JTextField,etc.
So, whenever i am passing that JPanel to constructor of StandardPrint,
multiple copies of Jtable is getting printed on many papers.
Please help me in solving this problem.
public void actionPerformed(ActionEvent e)
{
StandardPrint sp = new StandardPrint(b); // b is the instance of
JPanel.
try{sp.start();}catch(Exception x){}
}
|
works fine for me, printing a panel containing JTextArea, JTable,
JLabel, JButton.
one page only, showing all components and each one's text.
win98se, java1.4.0_01 |
|
| Back to top |
|
 |
Daniel Dyer Guest
|
Posted: Sun Dec 03, 2006 4:34 am Post subject: Re: Drawing on Tabs |
|
|
On Sat, 02 Dec 2006 20:49:18 -0000, SkippyBoy
<skippyboy2005+NOSPAM (AT) gmail (DOT) com> wrote:
| Quote: | Hi all - I have an application where my main frame has a tabbed
interface,
and each tab has a JPanel.
I would like to draw a line graph on the second tab (the first tab is
where
data is entered) and a bar graph on the second tab.
The problem I have is how to draw on the second or 3rd tabs.
I googled and one solution was to subclass the JPanel and then override
the
paintComponent() method. I tried but it doesn't seem to work. I am
probably
just doing it wrong.
How would I go about defining/extending the JPanel class? or is there
some
other container that would serve this purpose better?
Any help is appreciated.
|
Sub-classing JComponent directly is probably more appropriate. Even
easier is using a ready-made library such as JFreechart.
You might get better advice from comp.lang.java.gui (this reply is
cross-posted with follow-ups set to comp.lang.java.gui only).
Dan.
--
Daniel Dyer
http://www.uncommons.org |
|
| Back to top |
|
 |
Daniel Pitts Guest
|
Posted: Sat Dec 09, 2006 1:28 am Post subject: Re: Are there any good Java XML UI toolkits |
|
|
Dale King wrote:
| Quote: | Chris Uppal wrote:
Dale King wrote:
Is there any really good XML API for creating Swing UI's?
I can't help with suggestions for what already exists, but the thought strikes
me: how hard would it be to do yourself ? Since (as I understand it) you are
not looking for any kind of abstraction away from Swing, but rather the ability
to specify Swing GUIs in XML instead of boilerplate Java code, it seems that a
table-driven approach would be quite powerful. Your hand-written Java code
(for interpreting the XML) would be table driven, mapping XML tags/attributes
into Swing constructions via either reflection or some sort of factory; and the
tables would be generated (off-line) by reflection on the Swing classes.
YAGNI, of course, is your friend in any such project ;-)
Oh, this is definitely not driven by real need. I already have the UI
specified mostly in code.
I am kind of using this particular project as an experiment in terms of
investigating the best ways of doing things both for my learning and to
serve as example code. So I am very much over-engineering this. For
example, in one part of the code I am taking the MVC notion to the
extreme as learning exercise in what code should look like. I am also
being very emphatic that the code supports localization even though the
code will likely never be localized.
So YAGNI is not an issue for me here. I am not trying to do the simplest
thing that works. I am trying to investigate the most elegant, best
design that works.
I had rolled my own scheme for creating and localizing menus and
toolbars specifying the structure using Properties files. But that's all
that it supported and was not very satisfying. I've read about using XML
for specifying GUIs and there was a lot of buzz about it, but it seems
to me to mostly be hype and in the end they all seem to fall short. I
was hoping that I was just missing something.
--
Dale King
|
Google for Spring Rich Client. |
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Fri Dec 29, 2006 5:25 pm Post subject: Re: Java Helping Questions |
|
|
JS Smith wrote:
...you are the last in a long line of multi-posting spammers.
P*ss off.
(X-post to c.l.j.h./p./g./st., w/f-u to c.l.j.h. only)
Andrew T. |
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Wed Jan 10, 2007 7:32 pm Post subject: Re: About j2me application |
|
|
babu wrote:
Sub: About j2me application
About multi-posting. Please don't.
(X-post to c.l.j.p./g., w/ f-u to c.l.j.p. only)
Andrew T. |
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Thu Jan 11, 2007 10:10 pm Post subject: Re: Keyword extractor's source code....where I can find it?? |
|
|
giugy wrote:
Please do not multi-post* in future.
(..though congratulations on 'finding' the right group)
(X-post to c.l.j.g./h., w/ f-u to c.l.j.h. only)
* Send one message, to two or more groups.
Andrew T. |
|
| Back to top |
|
 |
Daniel Guest
|
Posted: Mon Jan 15, 2007 8:10 am Post subject: Re: Color-coded JProgressBar? |
|
|
I think what you are after is to make your own UI for the
JProgressBar, as this is controlled by the look and feel. There should
be a good base in java already to get you going. From my understanding
you do not have to create a whole look and feel, but you can just put
your littlle "renderer" into the table the UIManager uses to find the
class used to draw the component.
I must confess, that this is pretty much guesswork for mypart, but you
can start by looking at this, and there may also be other people who
know more about this that can offer better insights.
regards
Daniel
| Quote: | I'd like to use something like a vertical JProgressBar to
visualize the fill level of a container (a kanban card box,
in this case).
Can I define different colors (green, yellow, red)
for the parts of the progress bar corresponding to
normal, almost-full resp. critical fill-level, e. g.
based on percentages?
Any other out-of-the-box- control I could use to
achieve this?
Thanks for any pointers,
Sebastian |
|
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Sat Jan 27, 2007 8:10 am Post subject: Re: JTextField Unicode Mysql |
|
|
On Jan 27, 3:45 pm, "Badshah" <Surti.Soh...@gmail.com> wrote:
| Quote: | Hello Friends, How are you ?
|
Inundated with multi-posters coming out of
Google Groups, is how I am (i.e. annoyed).
In future, please x-post, rather than multi-post.
(X-post to c.l.j.p./g./h., w/ f-u to c.l.j.h. only)
Andrew T. |
|
| Back to top |
|
 |
Daniel Pitts Guest
|
Posted: Sat Feb 10, 2007 5:23 am Post subject: Re: Updating Multiple Views |
|
|
On Feb 9, 12:41 pm, "Jason Cavett" <jason.cav...@gmail.com> wrote:
| Quote: | Here's my problem...
I have one Model.
I can have multiple views to that model (depending on how the user
wants to see the information).
Problem: The user can have multiple views to the same model open at
the same time. If the user changes data in one view (which will
update the model), I want it to reflect in the other view(s). I
originally tried this by notifying all observers of the model (which
includes the original view that was just edited) and repopulating the
fields of the views. But, when I fire off the notification, I get
this exception:
Exception in thread "AWT-EventQueue-0 java.lang.IllegalStateException:
Attempt to mutate in notification
...whenever I edit a TextField or anything else with a
DocumentListener.
I sorta understand why this is happening (writeLock() and not being
able to modify while I'm notifying) but I am very confused on how to
fix it. Can anybody give any suggestions?
|
First, this is more on-topic at comp.lang.java.gui.
Second, your views shouldn't modify any part of the model based while
responding to a change in the model.
If you should implement a single model that represents all
interconnected aspects of your business domain, and have all of your
components able to read values from the model.
Having a model observer modify the model runs the risk of infinit
recursion or infinit loops. |
|
| Back to top |
|
 |
Jason Cavett Guest
|
Posted: Mon Feb 12, 2007 9:25 pm Post subject: Re: Updating Multiple Views |
|
|
On Feb 9, 6:23 pm, "Daniel Pitts" <googlegrou...@coloraura.com> wrote:
| Quote: | On Feb 9, 12:41 pm, "Jason Cavett" <jason.cav...@gmail.com> wrote:
Here's my problem...
I have one Model.
I can have multiple views to that model (depending on how the user
wants to see the information).
Problem: The user can have multiple views to the same model open at
the same time. If the user changes data in one view (which will
update the model), I want it to reflect in the other view(s). I
originally tried this by notifying all observers of the model (which
includes the original view that was just edited) and repopulating the
fields of the views. But, when I fire off the notification, I get
this exception:
Exception in thread "AWT-EventQueue-0 java.lang.IllegalStateException:
Attempt to mutate in notification
...whenever I edit a TextField or anything else with a
DocumentListener.
I sorta understand why this is happening (writeLock() and not being
able to modify while I'm notifying) but I am very confused on how to
fix it. Can anybody give any suggestions?
First, this is more on-topic at comp.lang.java.gui.
Second, your views shouldn't modify any part of the model based while
responding to a change in the model.
If you should implement a single model that represents all
interconnected aspects of your business domain, and have all of your
components able to read values from the model.
Having a model observer modify the model runs the risk of infinit
recursion or infinit loops.- Hide quoted text -
- Show quoted text -
First, this is more on-topic at comp.lang.java.gui.
|
Okay
I think there's some confusion (although, I have figured out a
solution to my problem).
I have a model - and, yes, there's only one. It extends Observable.
I have views - they implement Observer. The user can have multiple
views open to the same model. When the user makes a change to the
view, this triggers the controller which updates the model. The
model, once updated, fires off a notify to its Observers (all the
views) and the views are then updated. I used a flag so that a view
cannot be updated more than once in an "edit" (which prevents any
possibility of infinite loops).
I know MVC can be implemented in a few different ways (and nobody
seems to agree on one). If the way I'm doing it is flat out wrong, it
would be useful to know. (Or if there is a change I should be making,
I'd appreciate knowing that as well.)
Thanks for your help. |
|
| Back to top |
|
 |
Daniel Pitts Guest
|
Posted: Tue Feb 13, 2007 2:27 am Post subject: Re: Updating Multiple Views |
|
|
On Feb 12, 7:25 am, "Jason Cavett" <jason.cav...@gmail.com> wrote:
| Quote: | On Feb 9, 6:23 pm, "Daniel Pitts" <googlegrou...@coloraura.com> wrote:
On Feb 9, 12:41 pm, "Jason Cavett" <jason.cav...@gmail.com> wrote:
Here's my problem...
I have one Model.
I can have multiple views to that model (depending on how the user
wants to see the information).
Problem: The user can have multiple views to the same model open at
the same time. If the user changes data in one view (which will
update the model), I want it to reflect in the other view(s). I
originally tried this by notifying all observers of the model (which
includes the original view that was just edited) and repopulating the
fields of the views. But, when I fire off the notification, I get
this exception:
Exception in thread "AWT-EventQueue-0 java.lang.IllegalStateException:
Attempt to mutate in notification
...whenever I edit a TextField or anything else with a
DocumentListener.
I sorta understand why this is happening (writeLock() and not being
able to modify while I'm notifying) but I am very confused on how to
fix it. Can anybody give any suggestions?
First, this is more on-topic at comp.lang.java.gui.
Second, your views shouldn't modify any part of the model based while
responding to a change in the model.
If you should implement a single model that represents all
interconnected aspects of your business domain, and have all of your
components able to read values from the model.
Having a model observer modify the model runs the risk of infinit
recursion or infinit loops.- Hide quoted text -
- Show quoted text -
First, this is more on-topic at comp.lang.java.gui.
Okay
[...]
I think there's some confusion (although, I have figured out a
solution to my problem).
I have a model - and, yes, there's only one. It extends Observable.
I have views - they implement Observer. The user can have multiple
views open to the same model. When the user makes a change to the
view, this triggers the controller which updates the model. The
model, once updated, fires off a notify to its Observers (all the
views) and the views are then updated. I used a flag so that a view
cannot be updated more than once in an "edit" (which prevents any
possibility of infinite loops).
I know MVC can be implemented in a few different ways (and nobody
seems to agree on one). If the way I'm doing it is flat out wrong, it
would be useful to know. (Or if there is a change I should be making,
I'd appreciate knowing that as well.)
Thanks for your help.
|
Sounds like a reasonable approach, perhaps giving us an sscce would
help us identify your problem:
<http://physci.org/codes/sscce/> |
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Wed Feb 14, 2007 4:35 am Post subject: Re: problem with printing |
|
|
On Feb 14, 9:15 am, mario <marius...@gmail.com> wrote:
| Quote: | I have problem with printing:
|
I have a problem with multi-posting.
Please cross-post, rather than multi-post,
in future.
(X-post to c.l.j.p./g., w/ f-u to c.l.j.g. only)
Andrew T. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|