Updating a JFrame with a new panel
Hi,
i want to switch a JPanel placed in my JFrame. But if i do so, i always have to maximize the window and then bring it back again, to see the changes work completely.
I tried both repaint() and validate() but both do not work that I always have to maximize the window to see the changes.
Can anybody help me to solve this?
Thanks for answers in advance!
I don't know exactly what you mean by switching a JPanel.
You might want to read the CardLayout tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html
If you replace a JPanel you need to call revalidate on the parent of the JPanel you are replacing.
If you want further help post a Short, Self Contained, Compilable and Executable, Example Program ([url http://homepage1.nifty.com/algafield/sscce.html]SSCCE) that demonstrates the problem.
And don't forget to use [url http://forum.java.sun.com/help.jspa?sec=formatting]code formatting when posting code.
Similar Messages
-
i have apps to be updated but when i try to update them a message pops out saying "You have updates for other accounts, please sigh in with the other id". Can some one help me how can i still update the same with the new apple id ive created. As i dont have the access to the earlier id anymore.
You cannot. The apps are assigned to that Apple ID and there is nothing you can do to change that. You could choose to download them again with the new Apple ID, any paid apps will need to be purchased again.
Hope that helps. -
I updated my iPhone with the new update..and then it turned off...instead of turning back on it tells me to plug it into iTunes..and when I do iTunes tells me that my phone is in recovery mode and needs to be restored..is there anything I can do without restoring it?
Same thing happened here ~ tech guy at a local authorized Apple repair store said it had something to do with improper backup from which the restore would be made. Still have a phone that asks to be connected to Itunes but won't do anything else . . . frustrated.
-
my computer was restarted and now i want to connect and update my iphone with a new itunes. how do i do this without losing all my stuff on my iphone?
i didnt get a chance to back my phone up before the comp crashed
will i lose any of my stuff?When you open iTunes and plug in iPhone (iPod) to computer, it appear in the left bar. Then just simply right click on you iPhone (iPod) and choose Transfer Purchases, this should copy your purchased items to your computer.
Hope this help -
i have updated my phone with the new 6 IOS. Since doing this my icloud account keeps saying that verification failed and the certificate for service is invalid. Folowin this problem my phone also does not recognise my other iphone contacts so i cannot facetime or send imessage
You don't need an app. You need couple's counseling. I believe what you want to do may also be illegal in many jurisdictions.
-
iPod updates 2 touch with the new software, and from the update they are not connected with Time phase. They appear calling but never they enter the calls. I make calls with other users and if one connects but in these two not from the update
I use Firefox 95% of the time, and there's no problem with flash content (and I'm still at .55 - downloaded .64 last week but I haven't got round to making the change yet). At the rate they've been changing it recently it may well be out of date already .
I've been trying it in Safari, too with no problems apart from You Tube, but that's because I'm blocking Google cookies.
One thought does occur - if your Flash preferences are set to block all Local Storage, it may be that the problem site is trying to use Flash cookies (LSOs). I had this problem recently with the BBC iPlayer streaming content. Little Snitch notified an attempt to connect to a new URL - emp.bbci.co.uk.
If I disallowed it, no streaming; when I allowed the connection, it still wouldn't stream, so I did a bit of digging and came to the conclusion that it was trying to set a Flash cookie. When I unblocked, lo and behold - streaming resumed as normal.
I now have LSOs blocked in a more subtle way that lets the site think it's being set (but it ain't) and the streaming still works.
As for permissions repair - always repair from local; the permissions on the original disc will have been superceded by updates and new installations of Apple software.
DU needs to be reading the packages on the HD, not the (now out of date) install disc.
The recurring repair messages are normal and don't mean anything's wrong. As long as the final message is 'repair complete' there's no need to dwell on it.
http://support.apple.com/kb/TS1448 (for Leopard and Snow Leopard - Lion no doubt has it's own set). -
I update my iPad with the new version 7.0.3 and my game Hay Day also was updated, but with another Apple ID that is not mine, how can i change and put my Appel Id ??
Anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID
Apple ID FAQs > http://support.apple.com/kb/HT5622 -
I am trying to update my apps using a new user ID. I have changed it and I can't get it to change in the App Store. It keeps asking me for a password for my old ID??
YOu can't update your apps with the new apple id. All apps are tied to the apple id that was used to purchased it, you will need to enter your password from you old id to update.
-
I downloaded pages with an old apple id, now i cant update to ios5 with my new apple id
I downloaded pages with an old apple id, now i cant update to ios5 with my new apple id
Content is tied to the account that bought/downloaded it and it can't be copied or transferred to a different account - for apps only that account can download updates to them. So if you downloaded it via one account and then created a new account, you will need to use the original account to download updates or authorise it on your computer's iTunes.
-
I hve been creat a new apple id. Bt with this id i couldn't update my old app. It's require my earlier id's password . So is there any way that I could update my app with my new apple id?
Not without deleting it and then downloading it from the new Apple ID.
(96053) -
HT1438 will my ipad 2 update this summer with the new update
Can/will my IPad 2 update this summer with the new apple update?
The iPad 2 can be updated to IOS 7.1 now.
-
i changed my apple id and password but how can i update my iphone with the new apple id and password?i changed my apple id and password but how can i update my iphone with the new apple id and password?
You have to delete the old account, provide the password for the ID when prompted to turn off Find My iPhone, then sign back in with the ID you wish to use. This deletes the account and your iCloud data from your device, but not from iCloud. Provided you are signing back into the same account, your iCloud data will reappear on your device when you sign back in.
To avoid losing photo stream photos that are not in your camera roll, save them to your camera roll before deleting the account (open your my photo stream album, tap Select, tap the photos, tap the share icon -- box with upward facing arrow, then tap Save to Camera Roll). -
I owe 27 dollars on itunes and i got a 25 dollar itunes card if i were to update my account with my new credit card would the 27 dollars be deducted from my credit card or would the itunes gift card pay for the 25 and my card would pay for the $2 left.
Generaly, if you have an iTunes card and a valid credit card, you have the option of charging your purchases to eiher one or the other? By default, it goes to your iTunes card, but you can override that.
-
since updating my 4s with the new 7.0.2 my front camera is not working, all I see is blurred colors. Anyone know how I can fix this?
Yes... remove your finger from the camera lense.
-
Replacing existing panel with a new panel.
I don't use swing much and I have ran into a small problem.
What is the standard procedure for replacing a jpanel on a
jframe with another jpanel in the exact same position?
Say you had a form on the first panel, when the user clicks
next it display a new panel with a confirmation of the results
and disposes of the old one.
I have tried add,remove, setcontenpane. setvisible etc but nothing
works. Can someone explain?
Here is a small app which demonstrates my problem:
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class FrameTest extends JFrame implements ActionListener{
JPanel jp1;
JPanel jp2;
JButton jb1;
JButton jb2;
public FrameTest(String name) {
super(name);
init();
public void init() {
jp1 = new JPanel(new FlowLayout());
jb1 = new JButton("One");
jb1.addActionListener(this);
jp1.add(jb1);
setContentPane(jp1);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds(0, 0, 200, 200);
setVisible(true);
public JPanel panelTwo() {
jp2 = new JPanel(new FlowLayout());
jb2 = new JButton("Two");
jb2.addActionListener(this);
jp2.add(jb2);
return jp2;
public static void main(String[] args) {
FrameTest ft = new FrameTest("Test");
* On click I wish to replace panel one
* with panel two
public void actionPerformed(ActionEvent e) {
//What can I add here?
}RegardsI just took a look on the Java Tutorial and it is exactly what I am after.
Thank you.
Maybe you are looking for
-
Ipod does not work with new usb
i got my computer cleaned and a usb 2.0 pci card put in and now my ipod does not work with it, can anyone help
-
Some background...my computer went down because the motherboard went out. I installed a new one and it was DOA...so I went with an MSI 865PE Neo2-PFS (Platinum Edition). I got it up and running and everything is great except I get the following...
-
IMac 2012 Electric specifications
Hi, I'm looking for the right UPS to supply to 5 iMac 21", 1 time capsule, 1T external HD. Neighter I could find the VA electrical specifications for the new iMac 21". Can u help me? thanx
-
Hi, I would like to make an expansion of the account members, sorting the output based on the content of the account dimension property Table_Sorting. Has anybody tried doing it using the EVENE and MDX sorting instruction ORDER? Can you please share
-
Color flash in FLV files on Mac?
Ran into a strange bug where FLVs (played back via the netStream method) will flash a frame of color (usually red or green, but sometimes other colors) for a split second before the video starts. This only happens on Macs, and usually only if one vid