How do you handle this issue ?   HELP !!!

Hi
I am doing a simple GUI programming with netbeans 5 and have a big question to issue to myself at the moment. So I wish someone could give me a fine way to solve this.
The project would have around 10 different screens that contain various components like JPanel, JLabel, JTextField etc depending on the data to handle. But some of those components appear in almost every screens.
Now I don't want to put those common components into every screens but I want to make just a single JPanel screen which contains those things and use the JPanel screen at every other screens. This is the way I tried to and failed and want to know the solution.
My question is how does my approch could run well, or Is there any other simple way to do like this ? or more generous way ? Any good study resouces would be appreciated.
Thanks
Steve
here is the code:
/// This one is that I want to share with other screens
public class ModeControl extends javax.swing.JPanel {
public int MC_ADD = 1;
public int MC_MODIFY = 2;
public int MC_DELETE = 3;
private int mode;
/** Creates new form ModeControl */
public ModeControl() {
initComponents();
public void setMode(int m) {
if (m == MC_DELETE) {
chkDelete.setSelected(true);
} else if (m == MC_MODIFY) {
chkModify.setSelected(true);
} else {
chkAdd.setSelected(true);
public int getMode() {
if (chkAdd.isSelected()) return MC_ADD;
else if (chkModify.isSelected()) return MC_MODIFY;
else if (chkDelete.isSelected()) return MC_DELETE;
else return 0;
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
chkMode = new javax.swing.ButtonGroup();
chkAdd = new javax.swing.JRadioButton();
chkModify = new javax.swing.JRadioButton();
chkDelete = new javax.swing.JRadioButton();
setBackground(new java.awt.Color(204, 204, 255));
setFont(new java.awt.Font("Verdana", 0, 12));
chkMode.add(chkAdd);
chkAdd.setFont(new java.awt.Font("Verdana", 0, 12));
chkAdd.setText("Add New");
chkAdd.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
chkAdd.setMargin(new java.awt.Insets(0, 0, 0, 0));
chkMode.add(chkModify);
chkModify.setText("Modify");
chkModify.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
chkModify.setMargin(new java.awt.Insets(0, 0, 0, 0));
chkMode.add(chkDelete);
chkDelete.setText("Delete");
chkDelete.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
chkDelete.setMargin(new java.awt.Insets(0, 0, 0, 0));
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(chkAdd)
.add(28, 28, 28)
.add(chkModify)
.add(31, 31, 31)
.add(chkDelete))
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(chkAdd)
.add(chkModify)
.add(chkDelete))
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JRadioButton chkAdd;
private javax.swing.JRadioButton chkDelete;
private javax.swing.ButtonGroup chkMode;
private javax.swing.JRadioButton chkModify;
// End of variables declaration
/// This one is the test screen.
/// As I click the button, the JPanel should show the common things up here.
public class test extends javax.swing.JFrame {
ModeControl mc = new ModeControl();
/** Creates new form test */
public test() {
initComponents();
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 322, Short.MAX_VALUE)
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 58, Short.MAX_VALUE)
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(41, 41, 41)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(layout.createSequentialGroup()
.add(160, 160, 160)
.add(jButton1)))
.addContainerGap(33, Short.MAX_VALUE))
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(24, 24, 24)
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(24, 24, 24)
.add(jButton1)
.addContainerGap(165, Short.MAX_VALUE))
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jPanel1.add(mc);
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
// I have no ideas how does this part should be
new test().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}

I don't speak the netbeans language so I didn't look at the code, but from your
description, this might work
a frame (or panel set as borderLayout)
panel1 to hold all your 'permanent' components - this is added to borderLayout.NORTH (or SOUTH)
panel2 set as a cardLayout - this contains all your different 'view' panels, this
is added to borderLayout.CENTER
in panel1 you would need a way to navigate through panel2, next/previous buttons,
or perhaps a menu with the view panel names

Similar Messages

  • HT204088 OS X Mavericks caused my mac to shut down. How do you resolve this issue?

    OS X Mavericks caused my mac to shut down. How do you resolve this issue?

    Some crappy software you have installed caused your Mac to shut down. Boot into safe mode and see if you have a kernel panic log  in Console, System Diagnostic Messages. If so, post it here.
    http://support.apple.com/kb/HT1564

  • How are you handling battery issues on N95 ?

    Hi guys
    am new user to N95 and like everything about its features except battery. Definetly am not a heavy users,just few txt message,couple of pictures and songs nothing really compared what you guys are doing(from what i read from other posts).i've to charge it every day!!
    my question is ,how you guys are handling ? just a spare battery ? or upgraded some higher powered battery ?
    i even disabled 3G and running only GSM but still
    Thanks for your comments or advise.

    Have you upgraded your firmware to the latest V20? It has a 30% increase in battery life and RAM.
    Check by typing in *#0000# in your phone.
    Message Edited by 6280 on 31-Dec-2007 09:14 PM
    Nokia N95
    V 20.0.015
    0546553

  • App not syncing to ipod How do you fix this issue?

    We have download many apps over the years, and never had this problem.  My son tried to download Infinity Blade II, annd it will not sync to the ipod.  It keeps saying "1 item cannot be synced.  Check with Itunes for more info."  Any suggestions on how to fix this problem.  I did search Itunes for an answer, and they said, if problem persists, to contact the creator or the application. 

    Go to iTunes>Preferences>Advanced and clcik on Reset Warnings and try again. The look for why it will not sync.
    To contact the developer:
    http://infinitybladegame.com/infinityblade2/faq?utm_source=ib2&utm_medium=appsto re&utm_campaign=clashmob

  • SMTP traffic blocked by ISP how do you handle it ?

    I have recently installed the OCFO 10.1.3.07. We were using POP account previously and i had 2 account created in outlook (one using my SMTP server as outgoing mail server and the 2nd using the user ISP SMTP server) to let users send emails from home by letting them select the account in outlook before sending their mail without having them to configure anything.
    I am now stuck here. I tried replicating the same kind of setup using OCFO and a secondary IMAP4 account but it doesnt work. The mail stays in the outbox. The only way to send from their homes is to run the configuration wizard and change the SMTP server adress.
    How do you handle this? am i taking the wrong approach here?
    Thanks for any inputs.

    For anyone who might be interested,
    I have submited a SR to oracle support and the workaround to this issue is to Create a 2nd mail profile and configure the OCFO with a different SMTP server within that profile.

  • When I connect my IPAd 2 to my desktop pc via usb cable desktop opens import photo screen. I am trying to copy/move downloaded files from my PC to Ipad 2. How do I correct this issue? Tx.

    When I connect my Ipad 2 to my desktop (via USB) import photos screen open on desktop. I am trying to coppy/move files from desktop to Ipad 2. Import photos come up with import error and I cannot do anything else. How do you correct this issue? Tx. New user.

    Actually, you can get photos onto an ipad from a PC. Connect them via USB (or wireless sync if you have that set up), go to the photos tab in iTunes, I don't have iTunes in front of me but there will be an option to sync photos from a folder on the PC to the iPad. You can choose an existing folder or make a new folder specifically for this purpose. Put the photos in said folder and then sync.
    The photos from that folder will be transferred to your iPad

  • I have an Airport Extreme as my router and am using time capsule to extend the network in my new house. My ISP is only providing me 4-5 ip addresses and wants me to set up my router to issue out new ip addresses for all my devices.How do I fix this?Help

    I have an Airport Extreme as my router and am using time capsule to extend the network in my new house. My ISP is only providing me 4-5 ip addresses and wants me to set up my router to issue out new ip addresses for all my devices.How do I fix this?Help.
    They said I need to change my settings to NAT settings. I haven't been able to figure out or find anything. I have also spoken to Apple Support on the phone for hours without being able to figure out how to do this ( i don't think he knew much either lol.) Please help me because I've got about 15-20 devices in my house that require to be connected to the internet and this is just making things ridiculously slow and painful for me.
    Thanks!

    It is on DHCP & NAT under router mode yet my isp is still the one issuing ip addresses to my devices instead of the router issuing them

  • I downloaded a application to my iphone5, however when i open the application i receive a message stating that my device clock apperars to be incorrect as a result you may experience problems using this application. How do i fix this issue?

    Im trying to watch a show but because of this message its not allowing me to do so. Again the error message im receiving is " Your device's clock appears to be incorrect as a result you ,ay experince problems using this application" how do i resolve this issue?

    If there are problems with updating or with the permissions then best is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox application and save the disk image file to the desktop
    *Firefox 26.0: http://www.mozilla.org/en-US/firefox/all.html
    *Trash the current Firefox application (open the Applications folder in the Finder and drag the Firefox application to the Trash) to do a clean (re-)install
    *Install the new version that you have downloaded
    *https://support.mozilla.org/kb/Installing+Firefox+on+Mac
    Your personal data is stored elsewhere in the Firefox profile folder, so you won't lose your bookmarks and other personal data when you uninstall and (re)install Firefox.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox

  • When I try to use Mac Help or any other help menu, the help window opens up but it is empty.  How do I resolve this issue?

    When I try to use Mac Help or any other help menu, the help window opens up but it is empty.  How do I resolve this issue?

    Try moving these files to the Trash one at a time and test (but don't empty yet.)
    /Users/yourusername/Library/Preferences/com.apple.helpviewer.plist
    /Users/yourusername/Library/Preferences/com.apple.helpviewer.LSSharedFileList.pl ist
    If doing this doesn't help, then navigate to this location and delete the cache (but not the enclosing folder.)
    /Users/yourusername/Library/Caches/com.apple.helpviewer
    All are located in your home folder Library.

  • The recent software update on my HTC One has caused errors with Exchange ActiveSync issues. Calendar, mail and tasks sync fine but contacts won't sync. How do you correct this?

    The recent software update on my HTC One has caused errors with Exchange ActiveSync issues. Calendar, mail and tasks sync fine but contacts won't sync. How do you correct this?

    I had the same problem.  Here is what worked for me.  Open the mail app and delete your exchange account (Settings > Delete Account).  Then re-add your Exchange account.  After this my Exchange contacts showed up again. 

  • Lightroom Book: I have saved a book in progress and now I can not add anymore photos to the filmstrip.  How can I change this?  Help! (and thank-you).

    Lightroom Book: I have saved a book in progress and now I can not add anymore photos to the filmstrip.  How can I change this?  Help! (and thank-you).

    How to add photos to a saved book?

  • How do you handle multiple at the same address?

    My wife just got an iMac. She is using the Birthday feature in Address Book and iCal to track our friends and family birthdays and anniversaries.
    Question:
    How do you track it when multiple people are at the same address? For instance, our friends are a family of four, but they all live at the same address. Do you need to make a separate Address Book card for each of them, even the 1 year old baby? Or can you track multiple people in a single card with custom fields?
    If you do need to make multiple cards, then how do you handle mailing lists? For instance, if I make separate cards for all four of them, how do I make sure I only send on Christmas card when I use my Mac to print labels?
    Thanks for any advice.

    This is really an issue that you're going to have to resolve yourself since Apple's address book isn't really built with this in mind - darn it. For me there are three scenarios. First, a singleton. No problem. Second a family for which all members share the same information - acquantences to whom I don't send birthday greetings. These get one card and I'll put in both (or all) their names in the first name field (as in Bob and Jean). If there are children, in the last name field I'll add 'and Ken' or 'and the kids'. Third, a family for which some fields are different - perhaps cell phone number, birthday, etc.
    For mailing purposes, I create a holiday group and put the people I'll be sending cards to into the group.

  • I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    Hey kristiac,
    Thanks for the question. If I understand correctly, you have no service on the iPhone. I would recommend that you read this article, it may be able to help the issue.
    If you can't connect to a cellular network or cellular data - Apple Support
    Thanks for using Apple Support Communities.
    Have a good one,
    Mario

  • My iPhone is disabled, and I need to restore it, how do you do this?

    So I was just on the phone with Apple, and apparently you now have to pay for help on the phone? Stupidest idea ever, but what are you going to do? Anyways, some of my friends thought it would be funny to disable my phone, and now it says "Connect to iTunes" and whenever I connect it to iTunes, it says "iTunes could not connect to the iPhone "jakes iPhone" because it is locked with a passcode. You must enter your passcode on the iPhone before it can be used with iTunes." How do they expect me to enter my passcode when it's disabled? How do I fix this, it's bugging me that I can't get into my phone. Also, I heard you have to restore your iPhone, how do you do this? I don't know how the new iTunes works, it's really frustrating.
    P.S- When I tried to restore it, it says "Are you sure you want to restore the iPhone "jakes iPhone" to it's factory settings?"
    I don't want to restore my phone to it's factory settings, that's what it doesn't get.
    The point of the passcode is so that it doesn't get any person information taken away. But what's the point if this happens? I mean, either way, I have to delete all the crap anyways to get it working again... Please help me, thanks.

    The point of a passcode is to protect your information from "friends" who do things to you like they just did.  They have disabled your device and you have to restore your phone in iTunes.  Hopefully you have performed a backup recently and you can restore from that backup.  As far as paying for support, you don't have a mechanic diagnose and repair your car problems without paying so why would Apple or any other company not charge for support?  However, any charge that you have to pay for support to fix this issue......I would have my so called friends pay the bill.

  • I can't click on the tabs on my desktop firefox, firefox 30, how do you fix this?

    I have reset and still get this issue, I would go and click on open new tab and then I would see the tab on the toolbar. I would go and try to open the tab by clicking on it and it would not work. How do you fix this? I know about shortcuts but its irritating and I share the computer and the shortcuts is slowing productivity. Thank you in advance.

    The mouse does not activate a tab, but a keyboard shortcut like Ctrl+2 to activate the second tab on the bar, does work?
    The Reset was a good thing to try. But some add-ons may reinstall after a Reset so those are worth reviewing again.
    Users have reported some new tab dysfunction is associated with Conduit add-ons, such as a Conduit plugin and/or a "Community Toolbar" extension.
    You can check for and disable extensions on the Add-ons page. Either:
    * <u>Windows: Ctrl+Shift+a</u> , Mac: Command+Shift+a
    * "3-bar" menu button (or Tools menu) > Add-ons
    In the left column, click Extensions. Then, if in doubt, disable.
    Often a link will appear above at least one disabled extension to restart Firefox. You can complete your work on the tab and click one of the links as the last step.
    Does that help with the "+" button? If so, could you name the specific extension that caused the problem?
    You might also check the Plugins section of the Add-ons page. You can use "Never Activate" to disable plugins that you don't ordinarily use.
    Does that help at all?

Maybe you are looking for

  • What is the best way to clean up your mac and make it faster and run to an optimum level?

    Hi Everyone, Hope all is well Iv been running my mac pro for a long time now, its a Mac pro, 2x 2.26 GHz Quad Core Intel Xeon. 12 GB 1066 MHz DDR3 Ram Over time now it has become slower, at the moment its still running fine but im sure over time it h

  • Camera raw editor is, suddenly, beyond slow.

    While retouching in ACR (PS-CC) with the spot healing brush, ACR doesn't respond for 10 to 15 seconds while using the Spot Removal Brush and/or zooming in or out on the image. This just recently started happening and no changes have been made to my s

  • Dynamic program for alv

    Hi i want a simple dynamic alv code .

  • Oracle-BAM failed

    Hi can any body tel when I config new BAM I got the error Please correct the reported issue and redeploy the BPEL process. : Endpoint Activation Error. AdapterFrameworkImpl::endpointActivation - Endpoint Activation Error. The Resource Adapter was una

  • Need help installing PhotoShop 7 on new PC

    Error message "scratch disk full"won't let me install it. It is NOT full...it's a brand new 2T hard drive. I don't want to have to partition the hard drive. Any other way around this?