LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-23-2006, 07:09 AM   #1
hunterfighter
Member
 
Registered: Oct 2004
Location: Malaysia, Kuala Lumpur
Distribution: FreeBSD
Posts: 65

Rep: Reputation: 15
Java - repaint on tabbedpane


Hi,
I had a problem when I using the tabbed pane in Java. I create a tabbed pane. I add a panel on it.
When I click the close button which is coded to remove the panel from the tabbed pane. It still appear the drawing on the screen. Even the component is really been removed.
So, I minimize the application and restore back it. It only will repaint or refresh the screen for me.
Any idea to overcome the problem?
 
Old 09-23-2006, 10:13 AM   #2
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
Try repainting and revalidating the JTabbedPane
Code:
// create the tabbedpane and add a panel
JPanel panel = new JPanel();
JTabbedPane jtp = new JTabbedPane();
jtp.addTab("Panel", panel);

// remove the panel
jtp.remove(panel);
jtp.repaint();
jtp.revalidate();
 
Old 09-23-2006, 10:49 AM   #3
hunterfighter
Member
 
Registered: Oct 2004
Location: Malaysia, Kuala Lumpur
Distribution: FreeBSD
Posts: 65

Original Poster
Rep: Reputation: 15
Yeah the result still remain the same. Still can't make it repaint or refresh.
It only work sometimes. Depends on luck.

Last edited by hunterfighter; 09-23-2006 at 11:20 AM.
 
Old 09-23-2006, 12:50 PM   #4
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
try revalidate before repaint to see if it is better
 
Old 09-23-2006, 12:55 PM   #5
hunterfighter
Member
 
Registered: Oct 2004
Location: Malaysia, Kuala Lumpur
Distribution: FreeBSD
Posts: 65

Original Poster
Rep: Reputation: 15
It still the same. I try with

remove(jtp);
add(jtp);

it still same.

Last edited by hunterfighter; 09-23-2006 at 10:06 PM.
 
Old 09-23-2006, 10:31 PM   #6
hunterfighter
Member
 
Registered: Oct 2004
Location: Malaysia, Kuala Lumpur
Distribution: FreeBSD
Posts: 65

Original Poster
Rep: Reputation: 15
Will different OS different effect?
 
Old 09-23-2006, 11:11 PM   #7
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
i have run into some weird repaint issues before as well. its probably because i do not know the *right* way to do it, and what i do is probably cheating a bit. what i would do, that would work for sure, is to toggle the visibility of the component. do a

Code:
setVisible(false);
setVisible(true);
this will guarantee a repaint.
 
Old 09-25-2006, 06:46 AM   #8
hunterfighter
Member
 
Registered: Oct 2004
Location: Malaysia, Kuala Lumpur
Distribution: FreeBSD
Posts: 65

Original Poster
Rep: Reputation: 15
At last I know what the problem. You use any other library file for tabbedPane beside from Sun Java itself?
I use the 3rd party library file it got problem. after I use bak the original library file from Sun, it seems like no problem.
And I try your cheating skill. Haha it can't work for me. I better use back the original library file from Sun Java.

Last edited by hunterfighter; 09-25-2006 at 06:52 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slight Screen Repaint Problems (Using Slackware 10.2) byte weaver Slackware 2 09-05-2006 05:14 AM
xlib and child windows (repaint) SteQve Programming 5 03-10-2005 11:31 AM
Screens slow to repaint since 10.1 install jonr Mandriva 34 12-12-2004 12:12 PM
repaint problems with pop-ups, menus linux_inst Linux - Distributions 0 08-26-2003 06:54 PM
Delay on Frame Repaint in kwin... the.jxc Linux - General 0 08-03-2003 08:52 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration