This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!

Chantal Ackermann

Ranch Hand
+ Follow
since Sep 28, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chantal Ackermann

hi,
this method
tree.putClientProperty("JTree.lineStyle", "Horizontal");
does group the nodes just as you observed it.
to draw lines with the cell renderer create a line border that paints only the bottom line. there is an appropriate method in BorderFactory.
Chantal
16 years ago
when you start editing the TableCellEditor takes over the rendering of the cell that is currently edited. So I suppose your TableCellRenderer works fine (which is a JLabel) while you TableCellEditor seems to have problems displaying the font. the TableCellEditor is a JTextField. You might need to write you own TableCellEditor, or to extend the default one and change the font attributes?
cheers,
Chantal
16 years ago
you need a separate thread that couts the time from one user activity on to the next. with every button or mouse click or key input or whatever, the timer has to be restarted. hm, sounds like a lot of work.
another possibility is to listen for the inactivity of the main frame. then you would only have to count the time when the applicaiton frame(s) has(have) lost focus.
cheers,
Chantal
16 years ago
hi,
take a look at the CardLayout in Swing (see the Swing tutorial), and the StateMachine pattern.
Chantal
16 years ago
hi,
this should work (for JTextPane, as well):

cheers,
Chantal
16 years ago
hi Jennifer,
just to exclude some string comparison error:
could you try

actually, the cell renderer should handle the formatting of the numbers, not the model. in this case you could install a tablecellrenderer for the Double.class for example.
cheers,
Chantal
16 years ago
hi Jennifer,
try

cheers,
Chantal
16 years ago
hi,
I get your point concering the "many to one" relationship. I've always used a main window and a main controller which would be notified whenever windowClosing would be called on the main window. thus I had no "many to one" relationship. Considering your situation, I think your solution is very good and flexible.
What concerns the argument you give the constructor of the ExitAction: actually, it doesn't matter what window event has been the trigger of the ExitAction (it should have been some windowClosing thing, anyway). When ExitAction.actionPerformed is called, the only thing that might be of interest is the source of the event (the window). Thus, I would call (for example):
exitAction.actionPerformed(new ActionEvent(theWindow, ActionEvent.ACTION_PERFORMED, "Exit"));
you might be interested in the "shutdown-hook":
http://www.javaspecialists.co.za/archive/Issue011.html
cheers,
Chantal
16 years ago
no need to cry out loud...
have you had a look at TreeModel? if not you should. implement you own (or extend it from DefaultTreeModel). overwrite the method isLeaf(node) and getChildCount(node) etc. see the swing tutorial on JTree. you might want to provide your custom TreeNode implementation as well.
cheers,
Chantal
16 years ago
hi,
the JEditorPane is supposed to display formatted text. you will need some EditorKit that describes the pdf-format. As this is an open format you can either write the EditorKit yourself (see the HTMLEditorKit (javadoc and source)) or search the web for existing implementations. there should be as it should be rather common to display pdf in a java component?!
cheers,
Chantal
16 years ago
hi,
your Loglater class is broken, I think. you should not instantiate a Thread from inside itself. this looks like a loop. separate the controll from the logging functionality:

actually, as logging need not be necessarily sync you can use SwingUtilities.invokeLater() in any case. which saves you from checking for the event thread.
cheers,
Chantal
[ May 14, 2003: Message edited by: Chantal Ackermann ]
16 years ago
hi,
you might want to have a look at the "Event Generator Idiom". here is a good article by Bill Venners:
http://www.artima.com/designtechniques/eventgen.html
cheers,
Chantal
16 years ago
hi,
what do you mean by "highlight the JList"? the selection of a row?
you can easily transfer focus to the JList by preselecting the first row for example. by default no row is selected.
cheers,
Chantal
16 years ago
hi,
see this article for multine column cells:
http://www.javaspecialists.co.za/archive/Issue045.html
and this article for using any jcomponent as cell renderer/editor:
http://www.codeguru.com/java/articles/162.shtml
cheers,
chantal
16 years ago