Having a gui in one class use a gui in another?
Hi everyone,
I have created two separate classes for an employee program. My first class consists of a frame that adds a new employee to the program and my second class is the Main Program that is supposed to allow the user to choose what information about the employee the person wants to change. My dilema is that I don't know how to make my main program run the add employee program when a button is clicked. Am i using the right approach? Any suggestion and comments would be greatly appreciated.
Thanks in advance.....
hi,i am sure that u will have coded to add an employee from the add emp frame.as i understand your problem is to traverse to the add emp frame from the main frame.if thats what u need then u can use the setVisible(true or false) method of the frame class.when the button in the mail frame is clicked you can make the add emp frame to become visible and when they need to come back to the main frame then you can make it invisible.if i got your question right then this will be a solution,else explain your problem in detail and i will try to help.bye martian.
Similar Messages
-
How to copy an array element in one class to an array in another class?
Hi,
I have a ClassRoom class that stores a list of Student objects in an array. How would I copy a Student object from the Student[] array in the ClassRoom class to an array in another class?
Is it something like this:
System.arraycopy(Students, 2, AnotherClass.Array, 0, 2);In an array do the items get copied over existing array elements or can the be added to the end? If so, how would I specify add copied object reference to the end of the array in the other class?drew22299 wrote:
Hi,
I have a ClassRoom class that stores a list of Student objects in an array. How would I copy a Student object from the Student[] array in the ClassRoom class to an array in another class?
Is it something like this:
System.arraycopy(Students, 2, AnotherClass.Array, 0, 2);In an array do the items get copied over existing array elements or can the be added to the end? If so, how would I specify add copied object reference to the end of the array in the other class?System.arrayCopy will overwrite whatever is already in the array. It is your job to make sure it copies into the proper array location.
That being said, you're only moving a single student. This is not something you would use arrayCopy for, as you can just do that with simple assignment. Also, you should consider giving Class a method to add a student to its student list, as the class should know how many students it has and can easily "append" to the array.
Note: I hope you noticed the quotes around append. Java's arrays are fixed size. Once allocated, their size cannot change. You may want to consider using one of the List implementations (ArrayList, for example) instead. -
Having to display only one record using XML tags in XML Publisher
Hello,
I have a query which returns two rows for one particular contract number. Output contains in the following style.
ID | Contract_No | Item_Desc | Item_Num | colA | colB | Term_Dur
1 ABC1 Item1 12 Y Y 20
2 ABC1 Item2 13 Y Y 20
the rows returned are having a column called 'Term_Duration' which is same and I'm using the for-each loop mean for every different Item_Desc column, corresponding terms are being displayed in the RTF document. Here I want the report to display the contract details only once if the 'Term_Dur' value is the same when queried up for a contract number.
However the current RTF template is displaying both the two rows when the 'Term_Dur' is having a same value.
P.S: I am a novice in using the XML Publisher and please provide your suggestions on the above requuirement.
Thanks in advance,
UdaySeshu,
Do u want to display the inserted row...
Regards,
Gyan
www.gyanoracleapps.blogspot.com
www.querenttech.com -
Referencing a method in one class from a constructor in another?
Hi,
I'm not sure whether this is a simple question or not, but instead of rewriting the method in another class, is there a way that I can reference that method, eg:
public int getTitleCode() {
return titleCode; }within the constructor of another class. I don't want to use inheritance with this because it would change all my existing contructors.
Any ideas how to do this, or is it just simpler to add the method to both classes?
Many thanks!Hi,
I'm trying to use a method, defined in Class A, within one of the constructors in Class B. Class B object represents a copy of the output of Class A, with the addition of a few extra methods.
Therefore to represent the details correctly in the saved text file for class B, I need to call a method from class A to save the text file for class B correctly.
Class B saves a file with a reference number unique to that class, plus a reference number that is also saved in the text file for class A.
I can achieve the correct result for the above by having the same method in both classes, but I just wondered whether instead of this I could in fact call the method from class A in the constructor for class B. With the following code,
referenceNumber = refNum;
titleReferenceNumber = titleRefNum;
titleRefNum = titles.getTitleCode();
}I just get a 'nullpointerexception' when I try to run this in the main class.
Any help or advice appreciated! -
I setup a netlet that uses port 80 and some app specific ports for two different netlets. If I click on one (say webapp1), I will get the correct content for webapp1. I close webapp1. The next one (say webapp2) I will sometimes get the previous web site's (webapp1) content. It seems a little flaky. I wasn't sure if there is a timeout value needed here.
I setup a netlet that uses port 80 and some app specific ports for two different netlets. If I click on one (say webapp1), I will get the correct content for webapp1. I close webapp1. The next one (say webapp2) I will sometimes get the previous web site's (webapp1) content. It seems a little flaky. I wasn't sure if there is a timeout value needed here.
-
Controlling one timeline using an object in another?
Hello! I'd be very grateful if someone could help me out with
this.
I have two layers - each contains a different object. Each of
these objects have things happening on their own timelines. At a
certain point on object A's timeline, I want the user to be able to
click on it and jump to a different point on object B's timeline.
I have no idea how to do this, and any help would be much
appreciated.
Cheers,
Jamie.if the instance names of your movieclips are A and B and they
are on the main timeline from anywhere in your _level0 swf you can
use the following to refer to A (and B): -
Calling a Taskflow present in one App using a url from another Application
Hi,
I a have a requirement to call a taskflow present in another Application using a url from present JDEV Application.
Is that possible in JDEV 11g? Can anyone give me an example.
Thanks,
User
Edited by: user617801 on Feb 24, 2009 11:24 AMHi,
Check out this example . It is for TP4, but it should be the same on WLS.
Pedja -
Unable to connect to a database on one server using oracle client on anothe
Hi,
I am trying to connect to a database on zodiac server (10.180.173.201), from client installed on pluto server (10.180.173.203). But its giving the below error:
bash-2.05$ sqlplus CTEMEA_MWEL3/payplus@ctftdb1
SQL*Plus: Release 11.2.0.2.0 Production on Wed Mar 28 15:57:22 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-21561: OID generation failed
I went through online help but they were not clear.
kindly suggest
-AzadHi,
entry is there. But when i changes the oracle home path to that of the previous client i am able to login.
But when i set the oracle home path of 11g client its giving error.
Tks,
-Azad -
In java,how to trigger an event in one class from an event in another class
i need sloution to thisbecause, when the swing components are colloborating each other,i need to control the components with respect to others events.
eventListeners are the way to go.
-Js -
Using a variable from one class to another
Hi !
I've a class called ModFam (file ModFam.java) where I define a variable as
protected Connection dbconn;
Inside ModFam constructor I said:
try
String url = "jdbc:odbc:baselocal";
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
dbconn = DriverManager.getConnection(url);
System.err.println("Connection successful");
} ..... rest of code
This class define a TabbedPane as follows:
tabbedPane.addTab("Welcome",null,new Familias(),"Familias");
As you can see it call a new instance of the Familias class (file Familias.java).
This constructor will try to connect with the DB to populate a combo box with some data retireved from the DB.
If I do
Statement stmt;
stmt = dbconn.createStatement();
inside Familias constructor I receive the message
Familias.java:50: cannot resolve symbol
symbol : variable dbconn
location: class fam.Familias
stmt = dbconn.createStatement();
at compile time.
While I can�t use a variable defined as "protected" in one class of my package on another class of the same package ?
How could I do ?
Thanks in advance
<jl>Familias doesn't have a reference to ModFam or the Connection.
So change the constructor in Familias to be
public class Familias {
private ModFam modFam;
public Familias(ModFam m) {
modFam = m;
// ... somewhere else in the code
Statement stmt = modFam.dbconn.createStatement();
}or
public class Familias {
private Connection dbconn;
public Familias(Connection c) {
dbconn = c;
// ... somewhere else in the code
Statement stmt = dbconn.createStatement();
}And when you instantiate Familias it should then be
new Familias(this) // ModFam reference
or
new Familias(dbconn) -
Assigning object of one class to object of another class.
Hi,
How will i assign an object of one class to an object of another class?
Ex:
ClassX A=some_method();
Now how will I assign the object A of class ClassX to the object 'B' of another class 'ClassY'.In java you can only assign a object reference of one class into object reference of another class if the first class is the Second class (in other words the first class is a subclass of second class).
for example if this is a inheritance chart
Car ==========>Mercedes
"===========>Audi
then you can use
Audi a1 = new Audi();
Car c1 = a1;
or Mercedes m1 = new Mercedes();
Car c1 = m1;
but not
a1 = m1;
before assigning a variable into another variable of different class, use:
if(variable1 instanceOf ToBeAssignedIn Class){
variable2 = variable1;
example:
Audi a1;
Car c1;
if(a1 instanceOf Car){
c1 = a1;
Edited by: gaurav.suse on Apr 10, 2012 1:14 PM
Edited by: gaurav.suse on Apr 10, 2012 1:15 PM -
Variable sharing from one class to another??
Hi!!
Suppose two classes, one class extend from JFrame and another
from JDialog.I want to share the variable of Second one(extending JDialog) into firstone.How can I get this? please help me.For example:
In JFrame class...
JDialog theDialog = new JDialog ...
someVariable = theDialog.getVariable();
In the JDialog class, add the getVariable method. -
Right i'm trying the write the game Mastermind (if you have not played it or know what i'm on about heres a web site with the game on http://www.irt.org/games/js/mind/) Right so far its going pretty well, but i was talking to a friend who told me i should not just have one big class, so i'm having a go at useing class's , buts it not going very well. I'm trying to make the part of the program which random selects the colours in to one class and the rest of the program as another for the time being. Heres the code:
/// MasterMind1
import javax.swing.*;
public class MasterMind1 {
public class Random {
private static void Random(String args[]){
int [] test;
test = new int [4];
String guess;
int [] randomNumber;
randomNumber = new int [4];
for (int i=0; i < randomNumber.length; i++) {
randomNumber[i] = (int)Math.floor(1 + (8 * Math.random()));
System.out.println("no is " + randomNumber);
} // end for loop
test[0] = randomNumber [0];
test [1] = randomNumber [1];
test [2] = randomNumber [2];
test [3] = randomNumber [3];
//end class Random
public class void main (string arge[])
guess=JOptionPane.showInputDialog ( "Enter integer" );
playerGuess[0] = Integer.parseInt(guess);
guess=JOptionPane.showInputDialog ( "Enter integer" );
playerGuess[1] = Integer.parseInt(guess);
guess=JOptionPane.showInputDialog ( "Enter integer" );
playerGuess[2] = Integer.parseInt(guess);
guess=JOptionPane.showInputDialog ( "Enter integer" );
playerGuess[3] = Integer.parseInt(guess);
for (int i=0; i < test.length; i++)
if (test[i] == playerGuess[i] )
JOptionPane . showMessageDialog ( null, " Well done " +playerGuess[i], "hello",
JOptionPane.PLAIN_MESSAGE );
else
JOptionPane . showMessageDialog ( null, " Your wrong " +playerGuess[i], "hello",
JOptionPane.PLAIN_MESSAGE );
if (test[i]==playerGuess[i]){
pico [i]=2;
test[i] = 0;
playerGuess[i]=0;}
for (int i=0; i < test.length; i++){
if (test[i] != 0);
for (int k=0; k < playerGuess.length; k++){
if (playerGuess [k] != 0 )
if (test[i] == playerGuess[k]){
fermis[i][i]= 1;
test[i]=0;
playerGuess[k]=0; }
score [0]= fermis [0][0] + fermis [0][1] + fermis [0][2]+
fermis [1][0] + fermis [1][1] + fermis [1][2]+
fermis [2][0] + fermis [2][1] + fermis [2][2]+
fermis [3][0] + fermis [3][2]+ fermis [3][3];
score [1] = pico[0] + pico[1] + pico[2] + pico[3];
System.out.println (score[0]);
System.out.println ( score[1]);
System.exit( 0 );
}// end main
When i try to compill it just comes up with errors i'm not total sure why, mind you not sure what i'm doing anyways so its a bit hard to tell what i've done wrong. The way i've set the class's is it right? Also the Array with the random colours are in the 1st class, in the 2nd class do i need to do anything speical or does it not matter which class you make the array any class can see it and use it, even if its private?The basic structure of a class is something like this, but do have a look at the tutorials.
public class SomeClassName {
//Declare some member variables
int i;
Player player;
//Declare some methods
public int returnAValue(){
//Write some method code
public static void main(String[] args) {
//You don't need a main
// But if you have one it must have the above signature.
} // end class
-
Lots of info about one user using multiple computers. What about multiple users with separate Apple IDs using same computer? Having problems getting my wifes new iPhone talking to her apple account on the computer we share (2 users)
You need to create a user account for your wife (or yourself depending on who has the current user account). When syncing, each of you should sign in as a separate user, login to iTunes and then sync. I had this problem when my sister got an iPhone. When we did her initial sync, everything on my iPhone showed up on hers. Apple gave me this solution.
-
@I run a Windows 8.1 - Photoshop CS5 under Parallels on an iMac one year old and both having the latest OS. I use a NIK plugin "VIVEZA" which run fine for years without a problem. Latelt and without a reason, the NIK plugin has gone corrupt, (can not use it more the 2 corrections after a get a black background message that there is not enough memory) and the system stops running and a must restart is required. How do I fix this terrible problem?
If it requires a Photoshop CS5 re-install, (I belief that it may fix the problem) and re-install the two third party plugins (NIK Viveza) and (Onone Perfect Resize) how and where do I get to the proper Adobe upload page to do that.
I have tried to fix this problem by changing the memory allocations, I have spend many hours on it and are very disgusted with it but it needs to be fixed. The current memory settings are;
Ram available = 1588 MB
Range = 873 -1143 MB
Recommended Photoshop usage range = 857 however I have tried every setting to max and in between. Nothing works. Current setting = 1588 (max)
The Photoshop I use is registered, I have product # and order # .Contact NIK for updated/upgraded versions of their plug-ins. They have been having a lot of issues with their plug-ins.
Maybe you are looking for
-
DNS: reverse zone comes back after remove and some follow up issues
hello community, after installation of OSL i had setup dns with a primary zone. the automatically created reverse zone for my internal network is fine. whenever i enter a new system the default for the ip address is 10.0.0.1 and the reverse zone is a
-
Let addon run even after browser window is closed.
I want to use this addon - "Pushbullet" even after the browser window is closed. Such an option was available in Chrome when I used it last. I migrated to Firefox recently, and would like to know how to implement the same here. Thanks, Raj
-
Captivate 4 (Windows7 & 64bit) Audio Issue
Hello, I have read the Windows 7 & 64 bit thread about how Captivate 4 not work within a Windows 7/ 64-bit environment, some how it worked on this computer before I adopted it. I am trying to record audio on a project and when I go into Audio-Settin
-
Migrating 8.1.7.4 to 10.2: about apps
Hi plp, I'm migrating my db 8i to 10g, and I have a lot of applications (I've done them with Oracle Forms 6i/10g) that work with the db. My question is... what kind of changes I must do in my apps for them to be perfectly compatible with the new 10.2
-
Sap Archiving u0096 STO error on version ECC 6.0
Hi experts. I take a long of time with this error and I hope that you can help me. Explain the program. We have a archiving project of no standard objects. This objects run on Sap version 4.6C, but now, on version ECC 6.0, the Store program give a ex