Open two GUI( JFrame) simultaneously for one application

Can we open two GUI( JFrame) simultaneously for one application at tha same time.if yes why ?and if no why?

OK, its really simple, basically, you need a desktop frame to stor all the other frames and then you just pop them in, from a new class each time.
Here's the code from the demo I learnt it from:
(The demo itself)
import javax.swing.JInternalFrame;
import javax.swing.JDesktopPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JMenuBar;
import javax.swing.JFrame;
import javax.swing.KeyStroke;
import java.awt.event.*;
import java.awt.*;
* InternalFrameDemo.java requires:
* MyInternalFrame.java
public class InternalFrameDemo extends JFrame
implements ActionListener {
JDesktopPane desktop;
public InternalFrameDemo() {
super("InternalFrameDemo");
//Make the big window be indented 50 pixels from each edge
//of the screen.
int inset = 50;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds(inset, inset,
screenSize.width - inset*2,
screenSize.height - inset*2);
//Set up the GUI.
desktop = new JDesktopPane(); //a specialized layered pane
createFrame(); //create first "window"
setContentPane(desktop);
setJMenuBar(createMenuBar());
//Make dragging a little faster but perhaps uglier.
desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
protected JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
//Set up the lone menu.
JMenu menu = new JMenu("File");
menu.setMnemonic(KeyEvent.VK_D);
menuBar.add(menu);
//Set up the first menu item.
JMenuItem menuItem = new JMenuItem("New");
menuItem.setMnemonic(KeyEvent.VK_N);
menuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_N, ActionEvent.ALT_MASK));
menuItem.setActionCommand("New");
menuItem.addActionListener(this);
menu.add(menuItem);
//Set up the second menu item.
menuItem = new JMenuItem("Quit");
menuItem.setMnemonic(KeyEvent.VK_Q);
menuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_Q, ActionEvent.ALT_MASK));
menuItem.setActionCommand("Quit");
menuItem.addActionListener(this);
menu.add(menuItem);
return menuBar;
//React to menu selections.
public void actionPerformed(ActionEvent e) {
if ("New".equals(e.getActionCommand())) { //new
createFrame();
} else { //quit
quit();
//Create a new internal frame.
protected void createFrame() {
MyInternalFrame frame = new MyInternalFrame();
frame.setVisible(true); //necessary as of 1.3
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
//Quit the application.
protected void quit() {
System.exit(0);
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
InternalFrameDemo frame = new InternalFrameDemo();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Display the window.
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
Myinternalframe.java:
import javax.swing.JInternalFrame;
import java.awt.event.*;
import java.awt.*;
public class MyInternalFrame extends JInternalFrame {
static int openFrameCount = 0;
static final int xOffset = 30, yOffset = 30;
public MyInternalFrame() {
super("Document #" + (++openFrameCount),
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
//...Create the GUI and put it in the window...
//...Then set the window size or call pack...
setSize(300,300);
//Set the window's location.
setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
You should be able to tell from that

Similar Messages

  • TS1702 i cant download new application on my Iphone everytime i open app store then searching for the application i want to download when i Tap the FREE sign it become half square and never downloaded.

    i cant download new application on my Iphone everytime i open app store then searching for the application i want to download when i Tap the FREE sign it become half square and never downloaded.

    Sometimes this happens because the app won't run on the iOS version of the device you are trying to install it to.  Go to the app store and make sure it will run on iOS 3.1.3 (many only run on iOS 4 or higher).

  • One server certificate for one application? not for whole WebServer

    Hello,
    I am using SSL for the server- and clieint authtication. It works fine. But this authtication works for all applcations in this Webserver. How can I make it only for one application available? or one server certifiate for a certain application?
    Example:
    Config:
    <Connector port="8443" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" debug="0" scheme="https" secure="true" clientAuth="true" sslProtocol="SSL" keystoreFile="C:\temp\keystore\server\server.keystore" keystorePass="changeit" truststoreFile="C:\temp\keystore\server\trust.keystore" truststorePass="changeit"/>
    and all application used same server certificate:
    like: https://localhost:8443/myapp1
    https://localhost:8443/myapp2
    used same server certificate.
    How can I make one certificate for one application?
    thanks

    and I am using Tomcat 5.0 standalone

  • Can I run 2 versions of firefox? I need to run older version for one application

    My operating system is mac 10.6.8 and I need to be able to run firefox 3.6.19 for one application & the latest version of firefox for other applications. Can I have 2 versions of firefox on my computer and choose which one to run depending on my application?

    You can install the portable Firefox 3.6.19 version to access websites that do not work with Firefox 5+.
    *http://www.freesmug.org/portableapps:firefox#toc1

  • Emergent!! Two alternative material number for one same real material???

    Hi Experts
    In our company,for some specail requirement,we want to have two material numbers for one same real
    material,that means this two materials are substitute for each other. In every transaction, we can
    use this both two material numbers.
    For example,material number "A123 " and "B456" , these two material numbers are for one real
    material, In every transaction we can use "A123 " or "B456".For exmaple ,we can create and release
    a production order to produce"A123",and when doing goods receive for this produciton order with
    MB31,we could use"B456" for the same production order. And also when we view the stock for "A123" in SAP,we could get the the sum stock of "A123" and "B456".
    Is it possible in SAP? How to achieve it that one real material have two different material number??
    And how to manage these two different material number??
    Thanks for any reply!!

    Fei,
    The requirement can't be absolutely mapped in SAP.
    The reason is the logic behind this is wrong.
    May we know why do you want to maintain two separate codes for one real material?
    We have option of batch management as well as split valuation to take care of your requirement.
    Evaluate these things.
    Hope this helps you.
    SmanS

  • Two idocs are created for one output message type

    hi all,
    we are communicating our sap idocs to external system using ALE.It is working smoothly.
    Our problem raises here,
    .idocs are creating at the time of output type attachment for purchase orders.But rarely,two idocs are creating for one message type.It means two idocs are created for same Purchase order.It makes complications for the external system.
    anyone can help me pls?
    thnks in advance..........

    thanks jurgen for ur reply,
    jurgen, the second idoc is not an "ORDCHG",It is the replica of first idoc.This one has also "ORDERS" message type.The only difference between these idocs are the time.It means the difference between the time field segments of these idocs have only three(3)seconds difference.We think that its from the system error.If it is not from the system error pls give me the explanation.
    thanks in advance.......

  • Two table maintenance generator for one table

    Can we created two table maintenance generator for one ztable. if yes then what will be the steps.

    Hi Prem,
    Why you need two table maintenance generator for a single table?
    We can generate only single table maintenance  generator for a single table.
    you can add modification event in  inside table maintenance if you need anything to change or validate in insde your table maintenance generator.
    Regards,
    Prasenjit

  • Two cash flow hierarchy in one application

    Hi,
    We are running BPC version 7.0 .Currently we are running cash flow hierarchy as per indirect method . We need Cash flow as per direct method.Can we have two cash flow methods hierarchy in one application?
    Regards
    Chandan

    Hi Chanda,
    I believe you are maintaining the cash flows in your account dimension. You can maintain 2 hierarchies in the account dimension for different purpose.
    Hope this helps.

  • How to open two docs at once for a collage

    I am trying to create a collage. From reading Evening and Kelby it seems that I should create a blank document and then open the photos that I want to include. My next step is to make a selection or drag the whole file to the empty document. Finally, I should use free transform and move the layers around for my final result. My problem is that I cannot open two documents at once. If I create the blank document, once I open a photo it relaces the blank but I cannot have both open at the same time. I have looked through my books (no shortgage of photoshop books, just practical experience) and tried a search. Doers it make a difference if the photo I am trying to open is not in Lightroom or Bridge but simply on my desktop. I am certain that I am missing something simple but the solution eludes me. CS4 and an iMac 24. Thanks.
         Jack Polatin

    If you want to work in tabbed view, do it like this:
    Select the move tool. Go to the tab that contains one of the image files.
    Drag the image over the tab that has the blank document (Keep holding down the mouse button). Wait till that tab opens.
    Drag & drop the image into the blank document.

  • How to use two different database Drivers in one application ????

    I want to select datas in a result set of a query on a ms access database table and insert these into a mysql table of a mysql database in one application.
    Now my problem is that only on database driver is acceptet in the same application even it`s instanciatet in a completely different class !!!
    Here's the structure of my program:
    class one:
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database += filename.trim() + ";DriverID=22;READONLY=false}";
    java.sql.Driver driver0=new sun.jdbc.odbc.JdbcOdbcDriver();
    DriverManager.registerDriver(driver0);
    DriverManager.getDriver(database);
    con2=DriverManager.getConnection(database,"","");
    DatabaseMetaData dmd2;
    dmd2=con2.getMetaData();
    stmt2=con2.createStatement();
    rs2=("SELECT (.........
    until here all values can be selected correctly from ms access
    class2.get_gas_id(fla_gas);
    Now I want to insert these values into mysql.
    By despair i created a second class with another jdbc-method:
    class2:
    public class gas_select{
    public static int fla_gas_id;
    public static void get_gas_id(String fla_gas)
    java.sql.Statement stmt3;
    java.sql.Connection con3;
    java.sql.ResultSet rs3;
    FileWriter fout1;
    try
    java.sql.Driver driver1=new org.gjt.mm.mysql.Driver();
    DriverManager.registerDriver(driver1);
    DriverManager.getDriver(config.db_rge_stoffe); ==>
    config.rge_stoffe="jdbc:mysql://192.168.10.101:3306/rge_stoffe?user=<user>";
    con3=DriverManager.getConnection(config.db_rge_stoffe);
    java.sql.DatabaseMetaData dmd3;
    dmd3=con3.getMetaData();
    stmt3=con3.createStatement();
    rs3=stmt3.executeQuery("SELECT (Nr) from tblgaseliste where Gasart like "+"\'"+fla_gas+"\'");
    while(rs3.next())
    fla_gas_id=rs3.getInt("Nr");
    fout1.write(fla_gas_id);
    stmt3.close();
    con3.close();
    fout1.close();
    There's no result and no error message. Idon't know what to do !
    Has anyone an idea ???
    Edited by: goberger on Mar 27, 2008 3:35 PM

    Hi!
    If I understand your problem correctly, you can create connections to as many databases as you want in one class. In one of my programs I have connection to 3 separate databases, but here is an example:
    Connection mysql_con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbmysql", "root", "12345");
    Connection pg_con    = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5433/dbpgsql", "postgres", "12345");Then from mysql_con and pg_con create PreparedStatement or Statement then load selections into ResultSet and then use getString() to get a basic String type result that you want and so update table from each database.
    HTH
    Victor.
    BTW Here I use port 5433 for PostgreSQL connection because I SSH tunnel it from 5432 to 5433
    Edited by: vic_sk on Mar 27, 2008 4:23 PM

  • After updating to the latest version, I'm able to open and use the browser for one day. The next day, the browser doesn't not open up. please help!!!

    -reformatted computer, reinstalled everything
    -downloaded the newest version of mozilla
    -happily went online for one day
    -next day, browser does not load
    -later the next day, browser doesn't even open up
    -now when i go to open mozilla, something like this shows up:
    "server busy, taking too long...if your firewall is on make sure mozilla is allowed to browse...adjust proxy settings blah blah...

    HI Juanverano,
    Not a problem, Safe Mode will disable addons and hardware acceleration. If this continues and it is not an add on this will be the next step to try to disable acceleration:
    Try disabling graphics hardware acceleration. Since this feature was added to Firefox, it has gradually improved, but there still are a few glitches.
    You might need to restart Firefox in order for this to take effect, so save all work first (e.g., mail you are composing, online documents you're editing, etc.).
    Then perform these steps:
    #Open Firefox ''Options'' window (''Preferences'' on Mac or Linux) as follows:
    #* In Firefox 29.0 and above, click the menu button [[Image:New Fx Menu]] and select ''Options'' for Windows or ''Preferences'' on Mac or Linux.
    #* In Firefox 28.0 and previous versions, click the orange Firefox button at the top left, then select the "Options" button, or, if there is no Firefox button at the top, go to Tools > Options.
    #In the Firefox Options (or Preferences) window, click the ''Advanced'' tab, then select ''General''.
    #In the settings list, you should find the ''Use hardware acceleration when available'' checkbox. Uncheck this checkbox.
    #Now, restart Firefox and see if the problems persist.
    Additionally, please check for updates for your graphics driver by following the steps mentioned in the following Knowledge base articles:
    * [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    * [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    Did this fix your problems? Please report back to us!
    Thank you.

  • Two different invoices created for  one order for two different lines

    Hi All,
    I have an order with four line items that was shipped on the same day, invoiced on the same day and all lines have the same delivery number yet two inovices were created for this order..one for the first three lines and one for the last line.
    Can anyone please explain what can cause this to happen?
    Thanks
    A/A

    Hi Asgar,
    If a single order has been split into two invoices, you should check the values of the mandatory columns. During Autoinvoice, the grouping is based on the madatory columns and also your grouping rules. If any of the mandatory column has a different value, it will split into different invoice.
    Please refer the following metalink note for further details
    Subject: How Autoinvoice Grouping Works
    Doc ID: 98772.1
    Hope that helps.
    Thanks,
    Anil

  • Posting to Two different GL account for one condition type

    Hi All,
    In MM pricing procedure we are assigning one new condition type as Management Exp Charges.
    we creat two Transaction/Event key and assigned one in ActKy Colum and another in in Accural column.
    Suppose we are charging  10 $ towards Management Exp.
    Is there any way to Post 10$ in two different GL account.
    DR.Expnses account (As per GL assigned in Actky column) 10$
    Cr. Expenses Accural charges ( GL aasigned in accural Colum) 10$
    Howevre as per our current setting it was Cr to Accural account but for debit transaction it was going to stock/gain account.
    please help us to resolve this issue.
    Thanks in advance
    Regards,
    Lokanath

    Hi
    Can u specify why the customer two interest rates for one loan type.  Is the interest on loan going to change for any periodicity.
    Other wise you can create two loan types with nearest understandable naming convenction and use them for your business requirement.  Which ever is applicable for the employee can be selected by your customer.
    Brs
    Kenu

  • Solaris 10 zone config for one application

    I have a Solaris 10 x86 server with 48GB of memory and 8 CPUs (although I believe hyperthreading is turned on because prsinfo shows 16 CPUs). The server is dedicated to one big application which spawns many processes/threads. Performance is extremely important for this application so I need to give it all of the resources possible.
    I tried just allowing the application to run in the global zone because there's nothing else it will interfere with (aside from the OS) but I couldn't get it to utilize all of the CPUs this server has. My guess is the global zone is only designed for running the OS and playing traffic cop for the other zones, so it's not suited for running applications. Is that correct?
    So my question is, assuming I do need to setup a dedicated zone for this monster application, how do I configure it to dedicate all CPUs and all memory (or as close to all of it as I can get)?
    Also, is there some default limit on how much CPU % a process can have? Because I have tried getting one process to utilize 100% of a CPU and can't get anywhere near that... unless prstat doesn't display per CPU utilization information.
    Any help would be appreciated.

    Kupacmac wrote:
    I have a Solaris 10 x86 server with 48GB of memory and 8 CPUs (although I believe hyperthreading is turned on because prsinfo shows 16 CPUs). The server is dedicated to one big application which spawns many processes/threads. Performance is extremely important for this application so I need to give it all of the resources possible.
    I tried just allowing the application to run in the global zone because there's nothing else it will interfere with (aside from the OS) but I couldn't get it to utilize all of the CPUs this server has. My guess is the global zone is only designed for running the OS and playing traffic cop for the other zones, so it's not suited for running applications. Is that correct?No. Unless you have dedicated CPUs to zones (so they are not available to the global zone), or unless you're running under a project which restricts CPU usage, the global zone has access to all virtual CPUs.
    Can you see your process spawning threads? How much CPU is it able to use?
    Also, is there some default limit on how much CPU % a process can have? Because I have tried getting one process to utilize 100% of a CPU and can't get anywhere near that... unless prstat doesn't display per CPU utilization information.One thread can only use one CPU. So you'd either need to run 16 single threaded processes, or your process would need to spawn 16 threads that were CPU-heavy. No, there's no default limit on a process.
    Darren

  • WRT110: I want to create an access rule for one client for one application during one time period

    I have a problem with one of the clients on my LAN which is running uTorrent to detriment of everyone else. It saturates the pipe. I have been unable to prod this user into bothering to tweak their settings to throttle bandwidth back and so have resorted to an access rule on the router which kicks that MAC address off during a particular time period during the day. But as irritated as I am about this slacker sense of outrageous entitlement, kicking them off entirely seems a tad heavy handed even for me.
    So, In the router I can create a rule per MAC address and specify time. But is it possible to limit this to denying uTorrent ONLY? And if so what port or port ranges would I use.
    Alternatively I already use a QoS setting for one of my VoIP TA's. Would I gain anything by degrading the application indirectly by creating a QoS = LOW for that port range? Again, I don't really care about any other application, just uTorrent and just that client. How much degradation is there really in setting QoS to LOW?

    Well it wont make much difference, when you enable QOS service on your router. Yes it is possible to Deny uTorrent application from your Router. When you are Under "Application and Gaming" Tab, Under "Blocked Application" you will find "Application Name" , "Port Range" and "Protocol" so you need to input under Application Name "uTorrent" and under port range you need to input the port number which uTorrent application use and then under protocol select "Both" and click on ADD. Then again in Application you will find uTorrent , select and click on (>>) right arrow so it will block that application on your Router. By doing this it will block uTorrent from your Router.

Maybe you are looking for

  • How do i delete music off my ipod on my iphone?

    I have lot's of duplicate song's on my ipod and need to get them off so that i can have more space on my iphone....anyone know if this is possible and if so how do i do it??

  • Recording MBP soundcard output

    Hi all I'm a recent convert from Sound Forge on XP. I used to record DVD audio by playing the DVD and setting the sound card record settings to be the sound card output, then start DVD and start recording in Sound Forge. How do I do this in SP2 witho

  • Illustrator window resize issue

    Hi there, Getting this a lot when trying to open a file by association: It makes the window very small too - this is the creative cloud version. Any idea? Thanks, Shaun

  • HT1349 plssss...help me..i cant unlock my ipad2...i tried to slide the screen but it wont work

    please help....i cant unlock my ipad2...i tried to slide the screen but it wont work

  • Please let me plsql code standards

    Hi all, Please let me know if i am missing any plsql standards IF (    curr_rec.rqst_ctgry_lkpcd = 'AR'                 AND curr_rec.unfrm_blng_facility_type_code = 'B'             THEN                NULL;             ELSIF (    curr_rec.rqst_ctgry_