Mikko Kohtamäki

Ranch Hand
+ Follow
since Dec 13, 2008
Merit badge: grant badges
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mikko Kohtamäki

Not answering the question, but criticizing JOptionPane's UI class that why it lays out every component even after when only button text is changed?

Are these kind of old coding styles beeing ever updated only by better LookAndFeel packages.

Is there need to do hard coding changes, not only adding new ones. Then make compilers that updates the old stuff to new one.
9 years ago
Well this was not a thread issue (Swing issue), I posted too early. Sorry...

Issue solved, OptionPaneUI uninstalls and installs components after almost every property change. In where I wanted disable buttons.
I have one Thread that is working as a queue for another two thread which process the data. I may call them as DataLoader and DataProcessors.

DataLoader fires events how the progress is going on, or if processing is finished, cancelled, paused, etc. Say I want to disable some buttons when event is fired.

First I fired events using invokeLater() from DataLoader, I noticed that nothing happens. After this event fired (I had disable button code in JButton action for testing) I pressed the button, disablation works on second pressing time wtf... Please explain me why?

I have got it working by calling invokeLater() in GUI code (Listener) and run the buttons disablation code inside it.
Hi, had problem to fill the extra space of JTable when there are too few columns to fill the preferredScrollableViewportSize, when JTable's autoResizeMode is AUTO_RESIZE_OFF.

This example overrides configureEnclosingScrollPane() in JTable to rebuild whole new view.

JTableViewFiller listens LinkTable when it resizes to get new width for extra JTableHeader.

JTableViewFiller delegates LinkTable's Scrollable interface methods.

RendererPanel has a preferred size set that is updated, it has CellRendererPane which paints the extra JTable to extra space.

getHeaderViewFiller() is where you get the header view for JScrollPane.

I have a table that has visible row count, rows that dont exist in model, etc. Here I tried to do short and working example for JTable.
PROBLEM is that when I resize the column to right of actual table and if JScrollPane has defaults in ScrollBarPolicy (AS_NEEDED),
then horizontal scroll bar is FLICKERING... how to remove this behaviour or is this good at all ???

Will I set ScrollBarPolicies temporarely when resizing and table's width is less than preferredScrollableViewportSize.width

Try it, many thanks :)

11 years ago

I'm working on 'to-do table' component and it's mission is to layout job schedules for the week.

- JTableHeader is the column header
- JTable with one column and JTableHeader's renderer is the row header
- layout job schedules for the week
- close to timetable behaviour, but not
- rows can have various heights
- columns have individual row counts
- single component has mostly buttons, labels and icons or some graphics

- GridBagLayout + panels with components (HEAVY)
- JComponent with CellRendererPane (PREFERRED SIZE OF CELLS)
- multiple JTable components (SOUNDS CRAZY)

If I now start something, it can be scrappy work and then I have to start all over again

So I would need some help to get started, please.
12 years ago
If the area is large what your program is painting then use buffering as recommended before, or call repaint(Rectangle) to repaint only renewing area (if it aint the whole area)
12 years ago
Well I only checked that JTable notifies rowSorter if table's sortManager is != 'null' through tableChanged method, and this may work.. If you dont want table to sort every time the model changes...

12 years ago

eric aro wrote:
Therefore, IMHO, It's not fair to let newbies believe that visual building is evil. They will loose so much time, and code visual interface with so much fear !! Instead drawing a GUI, can be/should be fun !

I agree, my profession is not programmer (yet, heh), Java just stayed on my head in and after school (almost 4 years now). And i would say that i feared GUI programming because it is so massive and a bit complicated area to work on. Therefore GUI Builder should be a proper tool for newbie to learn But cant say if i would have learned GUI programming any faster, if i would have used a builder for programming which i haven't (just tried)

But at the time i dont and wont use any GUI builder...

13 years ago
Too long / comblicated explanation makes me sleepy, but

If I get this right the main problem here is the validation... how to do it properly and make it easy.

I Had problems with validation...
I was uncertain that how the validation progress is done properly and I shall share my experience and search on it... which is short

- Text Field Auto Tab - by Rob Camick, you get the picture from SizeDocumentFilter to do similar filters and using them as chains.
- Building a Swing Validation Package with InputVerifier - old but you get the message and modify it for your needs.

And I combined a bit of these two great examples i.e. bringing WantsValidationStatus to Rob's example etc.
13 years ago
Are you trying to flash the text or what?

13 years ago
And invokeLater can be (or should be) called only from EDT thread.

Use invokeAndWait (when calling from another thread) to do work in EDT, like the documentation says under the link...

And your above code can be written like
13 years ago

I'm not sure if you understand. Just to clarify, GUI builder is a tool that NetBeans has to create graphical user interfaces. :]

Yes I understanded I just enjoy more coding by hand, builders gives me a headache... in netbeans I think it uses GroupLayout only...
13 years ago
No I have not used GUI Builder, but Netbeans yes...
13 years ago
Sorry while I looked your code a little better just fix one line and add another in your orginal code



And the anchor thing you get from

like I said in last post
13 years ago

or you can try

for the component that contains GBL1Panel, but these often fails to function correctly

GridBagConstraints.anchor is used only for the components inside your GBL1Panel

Edit: and in GridBagLayout column widths are defined as what is the widthest component in column (component.getPreferredSize().width). you can use GridBagConstraints.gridwidth if some component should cover one or more columns
13 years ago