Results 1 to 12 of 12
- 04-26-2010, 12:04 AM #1
Member
- Join Date
- Aug 2007
- Posts
- 17
- Rep Power
- 0
Displayable container and JButton
Hi everybody. First, I want to apologize if my thread title is not very clear :o. I want to ask you to help me with this problem. I've just seen the JDateChooser component toedter.com (Java & More) website. I am programming a component very similar to this JDateChooser component, is to say, I want to have a JTextField and a JButton together. When the button is pressed it have to display a component (a JPanel I think) to show me some fields to input data and make calculations and put the result into the JTextField. How can I do this? I am sure it is very similar to this component because when the JDateChooser button is pressed the calendar appears to choose the date and put the selected one into the JTextField. How can I program the calendar container? And how can I make appear this container next to the text field? :confused:
Here's an image of this JDateChooser component:
-
This can be very simple or complex depending on your needs, desires, and abilities.
- 05-15-2010, 03:03 AM #3
Member
- Join Date
- Aug 2007
- Posts
- 17
- Rep Power
- 0
I mean this...
Hi everybody. I want to program something like this:

It seems it is using a combo box in the "Date & Time" field. When you push this component it displays the container with all the controls that you can see.
I just want to have the combobox (if it is a combobox) and the container.
Please help me with this.
Thanks in advance.
- 05-15-2010, 03:23 AM #4
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
What have you tried so far and what does or doesn't work? Your question is somewhat general, and the best that I can do is to direct you to the Sun Swing tutorials that tell how to create JComboBoxes, JSpinners, JButtons, and the like (look here: How to use Swing Components)
You're far better off doing as much of this yourself as you can and then coming here and asking a specific question regarding something that doesn't work or a specific point that you don't understand.
Buena suerte!
- 05-18-2010, 04:36 PM #5
Member
- Join Date
- Aug 2007
- Posts
- 17
- Rep Power
- 0
Custom JComboBox editor
Hi. What I want to program is a custom combo box. When the combobox button is pushed it has to display a container (that contains any other components like text fields or buttons) instead of the list items.
I can't tell it is exactly a combobox but it seems. As you can see in the image I previously posted there's an object in the "Date&Time" field that it is like a combobox but it displays the time and date controls.
Please give me a hand with this problem. I just want to have this combobox that has a container (maybe a JPanel with another components inside) as custom editor.
Thanks in advance.
- 05-18-2010, 06:02 PM #6
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
You've yet to post code showing what you've tried though. Please consider showing us that you've put a little effort into this.
- 05-26-2010, 08:41 PM #7
Member
- Join Date
- Aug 2007
- Posts
- 17
- Rep Power
- 0
Hi everybody. Thanks curmudgeon for answer. I had a few ideas to solve my problem but they didn't work. I know it would be helpful to show you what I've done until now but I want to tell you that all that I want is to have a combobox (if it is) with a container as custom editor. I want to have something like the component shown in the image I posted previously, the DateTimePicker from Lavantech.I don't mind the controls and the clock.
Please help me with this.
Thanks.
- 05-27-2010, 12:17 PM #8
Senior Member
- Join Date
- Jun 2008
- Posts
- 339
- Rep Power
- 5
A combo box is a control intended for displaying/selecting from lists of items. If you want to display a frame when the control is pushed, why not just use a button? You can make it whatever size you need and give it text and an icon if necessary - why are you so keen on misusing a combo box?
- 05-27-2010, 03:49 PM #9
Member
- Join Date
- Aug 2007
- Posts
- 17
- Rep Power
- 0
A group of components?
Hi everybody. Thanks dlorde for answering me. And yes, it's true that I've been trying to solve my problem using an combobox but sometime ago I realized that it's not the solution.
And I want to ask you to give some ideas to solve this problem. I tried using and JDialog and displaying it very close to the left bottom corner of a JTextField but it is impossible to take out the decoration, it's to say, the frame border.
How did the Lavantech programmers to have this group of a button, a text field and a container (to contain the controls) that is shown when the button is pushed? :o
Please help me.
Thanks.
-
I thought that decorations can be removed. JDialog inherits from Dialog which has a method setUndecorated(boolean decorate).
Last edited by Fubarable; 05-27-2010 at 04:03 PM.
- 05-28-2010, 07:08 PM #11
Member
- Join Date
- Aug 2007
- Posts
- 17
- Rep Power
- 0
JDialog and setUndecorated method
Hi everybody. And that's true Fubarable, JDialog inherits from Dialog and setUndecorated method exists but produces this exception:
Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: The dialog is displayable.
at java.awt.Dialog.setUndecorated(Dialog.java:1321)
at timepicker.ClockDialog.<init>(ClockDialog.java:11)
at timepicker.MainFrame.clockButtonActionPerformed(Ma inFrame.java:49)
at timepicker.MainFrame.access$000(MainFrame.java:8)
at timepicker.MainFrame$1.actionPerformed(MainFrame.j ava:37)
at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242)
...
But if still it could work it would be just a little window near the text field and the button then I'd have to deal with focus issues. I'm sure it is possible to have this container joined to the text field and the button, just like the DateTimePicker component from Lavantech but how? I don't know yet.
Thanks.
-
You may be calling setDecorated(...) after you've rendered the dialog by packing the GUI or calling setVisible(true). Make sure you set decorations before rendering. Please let us know if this helps or not.
Similar Threads
-
Applet as container .
By pawankumarom in forum Java AppletsReplies: 5Last Post: 04-23-2009, 06:17 AM -
[SOLVED] Coordinates container --> in parent container.
By Cleite in forum AWT / SwingReplies: 3Last Post: 04-21-2009, 11:01 PM -
AWT can we make a Tabbed container?
By Panchitopro in forum AWT / SwingReplies: 0Last Post: 05-15-2008, 10:31 PM -
Calling displayable from a canvas class
By Snalk in forum CLDC and MIDPReplies: 0Last Post: 03-28-2008, 11:58 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks