Is this the recomended way to create a GUI??

Hi all,
Is this method of creating a resizable form acceptable?package ddbms.gui;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTable;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Color;
import ddbms.gui.MenuBar;
public class GUIMainFrame
          extends JFrame {
     public GUIMainFrame() {
          super("Distributed Database Sampler");
          m = new MenuBar(el);
          this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          this.setJMenuBar(m);
          initComponents();
          // this.setContentPane(panel);
          this.pack();
          this.setVisible(true);
     private void sqlTable(){
          dbTable.setBorder(eb);
         dbTable.setModel(new javax.swing.table.DefaultTableModel(
                   new Object[][] { {null, null, null, null}
                   , {null, null, null, null}
                   , {null, null, null, null}
                   , {null, null, null, null}
                   new String[] {
                   "Title 1", "Title 2", "Title 3", "Title 4"
         dbTable.setGridColor(new java.awt.Color(204, 204, 204));
     private void initComponents() {
          buttonGroup = new ButtonGroup();
          jRadioButton1 = new JRadioButton("Site 1");
          jRadioButton2 = new JRadioButton("Site 2");
          jRadioButton3 = new JRadioButton("Site 3");
          jRadioButton4 = new JRadioButton("Site 4");
          radioButtonPanel = new JPanel();
          sqlTextField = new JTextField();
          sqlRunButton = new JButton("Execute SQL");
          textButtonPanel = new JPanel();
          radioLayoutPanel = new JPanel();
          commandBorderPanel = new JPanel();
          commandRootPanel = new JPanel();
          dbTable = new JTable();
          dbTableScrollPane = new JScrollPane();
          dataPanel = new JPanel();
          dataRootPanel = new JPanel();
          debugText = new JTextArea();
          debugText.setBorder(eb);
//debugScrollPane - holds debugText
          debugScrollPane = new JScrollPane();
          debugScrollPane.setBorder(new TitledBorder(eb, "SQL Monitor",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,new Font("Trebuchet MS", 0, 12),new Color(153, 153, 153)));
          debugScrollPane.setViewportView(debugText);
//Setup JTable for database         
          sqlTable();
//dbTableScrollPane - holds dbTable
          dbTableScrollPane.setBorder(new javax.swing.border.TitledBorder(eb, "Returned Table",TitledBorder.TRAILING,TitledBorder.DEFAULT_POSITION, new Font("Trebuchet MS", 0, 12), new Color(153, 153, 153)));
          dbTableScrollPane.setViewportView(dbTable);
//dataPanel - holds debugScrollPane(debugTextArea) & dbTableScrollPane(dbTable)
          dataPanel.setLayout(new java.awt.GridLayout(1, 2, 16, 20));
          dataPanel.add(debugScrollPane);
          dataPanel.add(dbTableScrollPane);
//dataRootPane - holds dataPanel(debugScrollPane(debugTextArea) & dbTableScrollPane(dbTable))
          dataRootPanel.setLayout(new java.awt.CardLayout(16, 16));
          dataRootPanel.add(dataPanel, "card");
//Radio Buttons
          buttonGroup.add(jRadioButton1);
          jRadioButton1.addActionListener(el);
          jRadioButton1.setActionCommand("1");
          buttonGroup.add(jRadioButton2);
          jRadioButton2.addActionListener(el);
          jRadioButton2.setActionCommand("2");
          buttonGroup.add(jRadioButton3);
          jRadioButton3.addActionListener(el);
          jRadioButton3.setActionCommand("3");
          buttonGroup.add(jRadioButton4);
          jRadioButton4.addActionListener(el);
          jRadioButton4.setActionCommand("4");
//Radio Button Panel- holds jradiobuttons
          radioButtonPanel.setLayout(new java.awt.GridLayout(2, 2));
          radioButtonPanel.add(jRadioButton1);
          radioButtonPanel.add(jRadioButton2);
          radioButtonPanel.add(jRadioButton3);
          radioButtonPanel.add(jRadioButton4);
//radioLayoutPanel - controls horizontal position of radioButtonPanel
          radioLayoutPanel.setLayout(new java.awt.CardLayout(180,0));
          radioLayoutPanel.add(radioButtonPanel, "card");
//SQLTextField
          sqlTextField.setBorder(eb);
          sqlTextField.setPreferredSize(new Dimension(500, 24));
//sqlRunButton
          sqlRunButton.addActionListener(el);
          sqlRunButton.setActionCommand("run");
          sqlRunButton.setPreferredSize(new Dimension(120, 25));
//textButtonPanel - holds sqlTextField and sqlRadioButton
          textButtonPanel.add(sqlTextField);
          textButtonPanel.add(sqlRunButton);
//commandBorderPanel holds textButtonPanel(sqlTextField, sqlRunButton) and radioLayoutPanel(radioPanelButton(r1,r2,r3,r4))
          commandBorderPanel.setBorder(new TitledBorder(eb, "SQL Test String",TitledBorder.TRAILING,TitledBorder.DEFAULT_POSITION,new Font("Trebuchet MS", 0, 12), new Color(153, 153, 153)));
          commandBorderPanel.setLayout(new java.awt.GridLayout(1,2, 0, 0));
          commandBorderPanel.add(textButtonPanel);
          commandBorderPanel.add(radioLayoutPanel);
//commandRootPanel holds commandBorderPanel(textButtonPanel(sqlTextField, sqlRunButton) & radioLayoutPanel(radioPanelButton(r1,r2,r3,r4)))
          commandRootPanel.setLayout(new java.awt.CardLayout(15, 0));
          commandRootPanel.add(commandBorderPanel, "card");
          getContentPane().setLayout(new java.awt.BorderLayout());
          getContentPane().add(commandRootPanel, java.awt.BorderLayout.NORTH);
          getContentPane().add(dataRootPanel, java.awt.BorderLayout.CENTER);
     private JPanel dataPanel;
     private JPanel dataRootPanel;
     private JScrollPane dbTableScrollPane;
     private JTable dbTable;
     private JScrollPane debugScrollPane;
     private JTextArea debugText;
     private ButtonGroup buttonGroup;
     private JRadioButton jRadioButton1;
     private JRadioButton jRadioButton2;
     private JRadioButton jRadioButton3;
     private JRadioButton jRadioButton4;
     private JPanel radioButtonPanel;
     private JTextField sqlTextField;
     private JButton sqlRunButton;
     private JPanel textButtonPanel;
     private JPanel radioLayoutPanel;
     private JPanel commandBorderPanel;
     private JPanel commandRootPanel;
     private EtchedBorder eb = new EtchedBorder();
     private MenuBar m;
     private EventListener el = new EventListener();
}

You could almost say that if you use any of the
layout managers it will auto resize the form if the
frame is resized.If thats the case am i not breaking the rules by adding panels on panels
to get the frame to keep the same relative look?

Similar Messages

  • Is this the fastest way to create a single color bufferedImage?

    Here is my code but it's slow sometimes. Is there a better way?
    BufferedImage bi = new BufferedImage(1600,1200, BufferedImage.TYPE_INT_RGB);
    int[] rgbs = new int[1600*1200];
    for (int j =0; j<1600*1200; j++)
       rgbs[j] = Color.RED;
    bi.setRGB(0,0,1600,1200,rgbs,0,1600);

    This will be even faster.
    int w = 1600;
    int h = 1200;
    int masks[] = new int[4];
    rv[0] = 0xff0000; // red
    rv[1] = 0x00ff00; // green
    rv[2] = 0x0000ff; // blue
    rv[3] = 0xff000000; // alpha
    SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,
                                                      w, h, masks);
    final int rawData[] = new int[w * h];
    DataBufferInt db = new DataBufferInt(rawData, rawData.length);
    WritableRaster ras = Raster.createWritableRaster(sm, db, null);
    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    ColorModel cm = new DirectColorModel(cs, 32, masks[0], masks[1],
                                         masks[2], masks[3],
                                         false,
                                         DataBuffer.TYPE_INT);
    BufferedImage  img = new BufferedImage(cm, ras, false, null);
    int value = 0xffff0000; // opaque red.
    int l = rawData.length;
    // Set the image to solid color of the value
    for(int i = 0; i < rawData.length; i++)
        rawData[i] = value;

  • What is the best way to create a SSRS 2005 Line Chart Report for a 12 month period?

    I'm looking for advice on how to create a SQL Server 2005 query and line chart report for SSRS 2005.
    I need to display the peak number of patients assigned to a medical practice each month for a 12 month period based on the end-user selecting a
    single month and year.
    I've previously created a report that displays all patients assigned to the practice for any single month but I’m looking for advice on how to
    how to produce a resultset that shows the peak number of patients each month for a 12 month period. I thought about creating a query that returns the peak count for each month (based on my previously created report which displays all patients assigned to the
    practice for any single month) and then use a UNION statement to join all 12 months but I'm sure that isn't the most efficient way to do this. The other challenge with this approach (twelve resultsets combined via a UNION) is that the end-user needs to be
    able to select any month and year for the parameter and the report needs to display the 12 month period based on the month selected (the month selected would be the last month of the 12 month period).
    For the report I’ve previously created that displays all patients assigned to the practice for any single month, the WHERE statement filters the
    resultset on two fields:
    Start Date - The date the patient was assigned to the practice. This field is never null or blank.
    End Date - The date the patient left the practice. This field can be null or blank as active patients assigned to the practice do not have an End Date. When the patient
    leaves the practice, the date the patient left is populated in this field.
    Using these two fields I can return all patients assigned to the practice during Nov 2012 by looking for patients that meet the following criteria:
    start date prior to 11/30/2012 (using the last day of the month selected ensures patients added mid-month would be included)
    AND
    end date is null or blank (indicates the patient is active) OR the end date is between 11/1/2012 -11/30/2012 (returns patients that leave during the month
    selected)
    Regarding the query I need to create for the report that displays the peak count each month for 12 months, I'm looking for advice on
    how to count patients for each month the patient is assigned to the practice if the patient has been assigned for several months (which applies to most patients). Examples are:
    John Doe has a start date of 6/01/2012 and an End Date of 10/07/2012
    Sally Doe has a start date of 8/4/2012 and no End Date (the patient is still active)
    Jimmy Doe has a  start of 7/3/2012 and an End Date of 9/2/2012
    Given these examples how would I include John Doe in the peak monthly count each month for May - October, Sally Doe in the peak monthly count for
    August - December and Jimmy Doe in the peak monthly count for July – Sept if the end-user running the report selected December 2012 as the parameter?
    Given the example above and the fact I'm creating a line chart I think the best way to create this report would be a resultset that looks like
    this:
    Patient Name              
    Months Assigned
    John Doe
    June 2012
    John Doe                     
    July012
    John Doe                     
    Aug 2012
    John Doe                     
    Sept 2012
    John Doe
    Oct 2012
    Sally Doe                     
    Aug 2012
    Sally Doe                     
    Sept 2012
    Sally Doe
    Oct 2012
    Sally Doe                     
    Nov 2012
    Sally Doe
    Dec 2012
    Jimmy Doe                  
    July 2012
    Jimmy Doe
    Aug 2012
    Jimmy Doe
    Sept 2012
    From the resultset above I could create another resultset that would count\group on month and year to return the peak count for each month:
    June 2012 - 1
    July 2012 – 2
    Aug 2012 - 3
    Sept 2012 - 3
    Oct 2012 - 2
    Nov 2012 - 1
    Dec 2012 - 1
    The resultset that displays the peak count for each month would be used to create the line chart (month would be the X axis and the count would
    be the y axis).
    Does this sound like the best approach?
    If so, any advice on how to create the resultset that lists each patient and each month they were assigned to the practice would be greatly appreciated.
    I do not have permissions to create SPs or Functions within the database but I can create temp tables.
    I know how to create the peak monthly count query (derived from the query that lists each patient and month assigned) as well as the line chart.
    Any advice or help is greatly appreciated.

    Thanks for the replies. I reviewed them shortly after they were submitted but I'm also working on other projects at the same time (hence the delayed reply).
    Building a time table and doing a cross join to my original resultset gave me the desired resultset of the months assigned between dates. What I can't figure out now is how to filter months I don't want. 
    Doing a cross  join between my original resultset that had two dates:
    08/27/2010
    10/24/2011
    and a calendar table that has 24 rows (each month for a two year period)
    my new resultset looks like this:
    I need to filter the rows in yellow as the months assigned for stage 3 that started on 8/27/2010 should stop when the patient was assigned to stage 4 on 10/24/2011.
    You'll notice that Jan - Sept 2011 isn't listed for Stage 4 assigned on 10/24/2011 as I included a filter in the WHERE clause that states
    the Months Assigned value must be greater than or equal to the date assigned value.
    Any advice would be appreciated.

  • WHAT IS THE BEST WAY TO CREATE AN XSD FILE (TO BE USED BY SOAP ADAPTER)

    Dear friends
    I have a simple scenario.
    OUTBOUND DATA  -->  SOAP ADAPTER  --> ( XI )  -->  RFC ADAPTER  --> INBOUND DATA
    The XML file that I got from mapping area of IR (Design) is as follows
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_NAME_SOURCE xmlns:ns0="http://test3.com">
       <FIRSTNAME>DAVE</FIRSTNAME>
       <LASTNAME>SMITH</LASTNAME>
    </ns0:MT_NAME_SOURCE>
    If you notice, there are only 2 fields.
    I need to create an XSD file and import it as an external object, which I can use for SOAP Adapter.
    Which is the best way to create it.
    Also, I need to know if there is any step by step of sending a message from XML SPY. I have downloaded this software, but am not able to undertand how to use this.
    Hope to hear from any experts on this forum.
    Thanks in advance
    Ram

    Hi Ram,
    See the below blog..
    It shows how to send SOAP message using XML Spy.
    It also shows how to generate wsdl.
    /people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
    Regards,
    Sumit

  • What is the best way to create a database schema from XML

    What is the best way to create a database schema from XML?
    i have  a complex XML file that I want to create a database from and consistently import new XML files of the same schema type. Currently I have started off by mapping the XSD into Excel and using Mysql for Excel to push into MySQL.
    There must be a more .net microsoft solution for this but I cannot locate the topic and tools by searching. What are the best tools and way to manage this?
    Taking my C# further

    Hi Saythj,
    When mentioning "a database schema from XML", do you mean the
    XML Schema Collections? If that is what you mean, when trying to import XML files of the same schema type, you may take the below approach.
    Create an XML Schema Collection basing on your complex XML, you can find
    many generating tools online to do that.
    Create a Table with the above created schema typed XML column as below.
    CREATE TABLE youTable( Col1 int, Col2 xml (yourXMLSchemaCollection))
    Load your XML files and try to insert the xml content into the table above from C# or some other approaches. The XMLs that can't pass the validation fail inserting into that table.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • What is the best way to create a read more/collapse text box on the homepage of a site?

    What is the best way to create a read more/collapse text box on the homepage of a site?

    I figured this out by using a lightbox. I set the trigger at the top of the box, hid all initially and added a close button. In the box that would have linked to the first thumbnail for the lightbox, I added a text box that said "read more"

  • What is the best way to create Aperture book from Pages '09 document?

    What is the best way to create Aperture book from Pages '09 document?

    There is no way to import pages documents to Aperture and convert them to an Aperture book. Aperture books can only be created by manually adding images and text to the pages of a book, and using the layout of the predefined templates.
    The best you could do, would be to print your pages document to pdf and import the resulting pdf file into Aperture as a new project. This will create one image for each page. Then select the page images all at once and  create a new book. Select a theme with fullsize page images, like "picture Book", and then add the images of the pages to the empty pages of the book.
    But probably would you get a much better quality and layout, when you recreate your pages document in Aperture, by starting with an empty book and copying and pasting the text from your Pages document. But don't paste the photos from the document - try to use the originals of those photos.

  • Dw, css, and a template, what is the best way to create a 20 page website with a different header in each page?

    dw, css, and a template, what is the best way to create a 20
    page website with different header content on each page? i am
    trying to insert a specific image and background color for each
    header on every page. what is the easiest or best way to do this?
    thanks, bryan

    "mediastream13" <[email protected]> wrote in
    message
    news:f47bes$9om$[email protected]..
    > ok, murray, here is the site.
    http://www.helphotline.org
    > in I.E. 6 i can't see the background color behind the
    header images,
    I'm seeing a hot pink background (which is my browser default
    - so that I do
    remember to declare a background color). You need to add:
    body { background-color: white;} to your stylesheet, or into
    the imbedded
    styles on your page.
    In Firefox, the very top black section, #headertop is hidden
    behind the
    header image.
    > background of the date/time isn't stretching the full
    length of the
    > screen, and
    > the margins aren't working in the main content area. how
    can i put a
    > background
    > color behind the header images?
    I can see the header image stretching right across the page..
    so not sure
    what color is missing there.
    > is there anyway to download i.e. six on my computer if i
    already have
    > i.e.7? i
    > just want to be able to preview the site before i upload
    the changes. it
    > seems
    > everything works in i.e. 7.
    Yes, I used this and it works really well.
    http://tredosoft.com/Multiple_IE
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    ~ Customisation Service Available ~
    http://www.csstemplates.com.au

  • What is the best way to create a multilingual site using adobe Muse?

    hello, inside Muse its ok with linking the menus to the different language sites, BUT if my site in german have 20 pages and i have to made the tablett and sphone version, will this be to heavy for Muse ? (of course the images will be optimised to the best size)… OR when i make a different muse document in english and upload it in a subdirectory on my hosting, how must the name of this english site of my german be? and how can i link them ?
    Thanks for help and comments, jc

    For me, as a noob, It's all about creative problem solving.
    For lots of stuff, there's no right or wrong solution, but you have
    to figure things out on your own. I, too, have built sites from the
    ground up, and then rebuilt them even better. It's the only way to
    really learn it well. Books, online forums, help docs all sort of
    help, but it all comes down to how innovative you can be with
    integrating them all into a site that is completely yours.
    This might save you loads of headaches: avoid using scenes,
    unless you are doing only animation. Keep each of your 'pages' on
    their own keyframe, and use 'gotoAndStop' to navigate through them.
    This is perhaps the easiest way to create a website quickly.
    P

  • What is the best way to create a Flash site

    Hello Everyone,
    I am realtively new to flash. I created the splash page of
    our site in flash but 1st off it takes to long to load as it is.
    But I would like to create the entire site in Flash. What is the
    best way to create a Flash site, and are there tutorials out there
    or any really good books, resources, or online classes to learn
    Flash well. I understand the basic of flash and have created
    banners, and other flash materials.
    Can anyone help?

    For me, as a noob, It's all about creative problem solving.
    For lots of stuff, there's no right or wrong solution, but you have
    to figure things out on your own. I, too, have built sites from the
    ground up, and then rebuilt them even better. It's the only way to
    really learn it well. Books, online forums, help docs all sort of
    help, but it all comes down to how innovative you can be with
    integrating them all into a site that is completely yours.
    This might save you loads of headaches: avoid using scenes,
    unless you are doing only animation. Keep each of your 'pages' on
    their own keyframe, and use 'gotoAndStop' to navigate through them.
    This is perhaps the easiest way to create a website quickly.
    P

  • Whats the best way to create USER variable in BI Apps?

    I have just installled BI Apps and am trying to integrate EBS R12 with OBIEE 11g
    We have USER variable already defined in the BI Apps rpd.
    In EBS Security context init block i need to define USER variable, but when i define it... it says *'USER' has already been defined in the variable "Authentication"."USER"*
    Whats the best way to create USER variable for EBS Security Context init block?
    1) Delete the existing USER variable and then define a new one ( in this case all the places where USER variable is getting used in the rpd would become <missing>)
    And i was told that it should not be done.
    Let me know how can it be done.
    Thanks
    Ashish

    Disable existing Init block and then double click on USER variable and hit on NEW... button to create new Init block
    Thanks
    Edited by: Srini VEERAVALLI on May 1, 2013 4:18 PM

  • What is the best way to create 10000 users in ECC system

    Dear all,
    what is the best way to create 10,000 users in ECC 6 system.
    As of my knowledge we can create with SECATT, but I don't know the procedure to use this.
    please guide me...
    Regards,
    Raaja

    Hi Raaja,
    If you search in SDN or on google for eCATT tutorial, you will get all the info you need to learn to create them.
    For 10000 users I would suggest the following
    1. eCATT to create user ID's (include all the info like passwords, user groups in here).
    2. eCATT to make the role assignment.  Use SU10 to record the assignment to the users you created with the first script as it gives you more flexibility
    If you have the data you need then you should be able to run both steps in 1 work day (dependent on system performance).
    Edited by: Alex Ayers on Jan 25, 2009 11:16 AM

  • What is the Easiest way to create a playlist?

    What is the easiest way to create a playlist without going through all 1500 in my iTunes?  I know some artists I want all their songs.......others I don't.

    I have WMP on my computer and know you can quite easily make playlists within it.
    Then if you connect your player to the computer and drag and drop the playlist into the sync
    screen you should then be able to transfer it to the player.
    Not tried this way as I always use Zen Media Explorer for making playlists.
    Gi've it a try-you have nothing to lose.
    Best of Luck
    ZENFLASH

  • What's the best way to create a login page in muse?

    Hi.
    Busy exploring muse I came across another problem:
    What’s the best way to create a login page in muse?
    I want to create 1 page on a site with access for people with login details only.
    Sorry for beeing a newbie
    Dutch greets
    Toin Corten

    Hi Toin,
    Never need to apologize for being a newbie...we all were at one point or another. 
    I am going to move this question to the main Muse forum where you'll have a much better chance of getting a response.  This particular forum is for questions around our Muse getting started project.
    You may also want to check this thread out: http://forums.adobe.com/thread/1004543.
    Thank you,
    Ed Sullivan

  • BC4J datatags: is this the best way to do this?

    In my BC4J JSP application, in the DataTableComponent.jsp, I want to check
    if a property exists on the view object. This is the best way I could come
    up with:
    String PropertyValue =
    (String)dsBrowse.getApplicationModule()
    .findViewObject(dsBrowse.getViewObjectName())
    .getProperty("PropertyName");
    Is this the proper way to get at a view property? Seems like it should be more straightforward.
    Also, does an instance of the ViewImpl class get automatically created when the DataSource tag is used or do you have to specifically instantiate it if you want to use a client method on the view?
    Thanks,
    Steve

    You can do:
       String propVal = dsBrowse.getRowSet().getViewObject().getProperty("PropName");You do not have to instantiate any classes on your own to accomplish this.

Maybe you are looking for

  • Views on CF Report Builder and Crystal Report

    Dear all, I would like to get your opinions on CF Report Builder and Crystal Report. As we all know, CF Report Builder is a new reporting tool. But I find it very difficult to design a complex report maybe due to limitation in its functionalities. So

  • Hi I got error regarding crystal report generation in jsp

    Iam using crystal reports in my JSP. But, iam getting the error like "package com.crystaldecisions.reports.sdk not found in import". import com.crystaldecisions.reports.sdk.*; can anybody please help?

  • How to have backend account determination working SRM

    Hello everybody Just came across thread EBP G/L Account Assignment doesn't  follow R/3 Account Determination while I was searching for a solution to this same problem I'm having here as well. I already thought about using BAdI BBP_DETERMINE_ACCT. But

  • Can security programs on pc interfer with iphone syncing

    Recently changed my home page to Start Page the Worlds Most Private Search Engin, upgraded Norton Security Suite, installed CCleaner and Constant Guard.  Could any of these program not allow iphone to sync pictures or videos to PC?  When I plug iphon

  • Help me about the ipod battery

    Did the battery test as apple said to, but i only got about 8 hours out of it and ive only had it for about 1/2 months! Is this normal? Or is my ipod faulty in some way? Paul