Steve Schowiak

Greenhorn
+ Follow
since Oct 21, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steve Schowiak

I figured it out. If you right-click on the variable declarations at the bottom of the code, you can change public/private access.

Thanks anyway!
I want to change the text of a jLabel in another class at runtime from within a Java application. That class is declared as public:

public class bank extends javax.swing.JPanel { ...

I am getting this compile error:

C:\Documents and Settings\Steve\J95\src\j95\main.java:18: bankJLabel has private access in j95.bank this.bank1.bankJLabel.setText("1");

This is the code in question:

public main() {
initComponents();
this.bank1.bankJLabel.setText("1");
// so on and so forth ...
}

NB 4.0 sets some variables as private at the bottom of the code in the main application class, but I'm not sure if this has anything to do with the problem:

private j95.bank bank0;
private j95.bank bank1;
private j95.bank bank2; ... etc.

The IDE won't let me change it to public so the jLabel can be accessed. I'm not sure if this is a problem with the IDE or me. Probably me . Can anybody offer a clue? The complete listing of the main application code follows. The application and other classes otherwise run fine. Thanks!:

Is the mainframe being used for batch jobs or for real-time queries? If batch, you could insert steps in the job stream somewhere that calls a program that will just read the database and re-write data to a simple sequential file. You can use that file for use with just about anything else. If it's a real-time transaction scenario, then it's more problematic.
I agree with Gary. The easiest way to to port this over to a new platform is to write a quick and dirty COBOL program that reads the ISAM file and spits it back out in a plain sequential file, delimited with TAB's for MySQL. It might also be done using a DYL script or FileAide. You could insert a step in your JCL/JOB to handle this. Then just FTP the sequential file to your new environment. Porting the actual ISAM file itself would be a REAL pain in the butt.
Hmmmmm. ISAM files. That's real old stuff. Before the IT market went down the toilet, I used to ba a rather accomplished mainframer. Never dealt with an ISAM file yet though.
I am an experienced systems programmer, currently not employed in my field. No jobs for mainframe/COBOL programmers anymore. I've taken a course in Java programming and taught C++ in a private college before. I have the essentials of Java down fairly well (I think), it's just the nitty-gritty, GUI, objected-oriented stuff that throws me for a loop sometimes.
I use the visual IDE because I like the convenience of the drag/drop assembly of the GUI portion of Java. Don't have to full around with x-y coordinates, size of components, positioning, etc., and allows me to concentrate on the logic. Just double-click on a component, and an event object is generated, and I just fill in the rest of the logic. It also guards against typos, which I am famous for. IDE's are project oriented, which is nice when you have several classes involved.
I am weak and lazy, I must admit, but RAD is the way to go for me!
Now I must digress.
I found that if you right-clicked on the the name of the component in the component browser, you can change the actual name. Ahhh, sheeezzz ...
Thanks all, for your support!
[ September 24, 2003: Message edited by: Steve Schowiak ]
I am applying a name to a component, i.e. a jTextField and name it so: "myTextField" in the property sheet. I am checking to make sure the setName method for the textfield has been invoked and it has. So now, I should be able to reference the object as 'myTextField.somemethod()', right?
Later in the code I refer to the jtextfield like so: myTextField.setText("blah blah blah"). The compiler give a 'cannot resolve symbol' error. When I use the given name 'jTextField1' for that object, everything works OK. I would like to give meaningful names to my objects, rather than use 'jTextField1' and so on.
What am I doing wrong?
I think you are saying that I can pass the applet itself from the already running applet?
Like:
DeckofCards deck = new DeckofCard(this);
If so, how do I define the data type of the parameter in the constructor of DeckofCards? And once I have the applet in there, then I can reference all the methods of Applet?
20 years ago
Please help a Greenhorn.
I am writing a simple Blackjack applet (ya, it's been done a million times before, but I'm new to Swing/AWT and trying to test my OO skillz)
I alway get a compile error on the line with '>>>>>' :

Error is:
[BOLD]cannot resolve symbol: method getCodeBase ()in class BlackjackApplet.DeckofCards at line 20 (20:30)[/BOLD]
The thing is I found some code on the web that uses a similar line and it works.
Any help out there?
Thanks!
Steve
20 years ago
As far as I know, you could install the newest and overlay the oldest, and it should work. But to be on the safe, I would uninstall the old and install the newest version.
21 years ago
I have found 'Sams Teach Yourself Java 2 In 21 Days' by Lemay and Cadenhead, Sams Publishing, very helpful.
21 years ago
You should have been a little more specific in your AND expression. You wrote:
if (nAngle >= 0 && < 90)
You should have wrote:
if (nAngle >= 0 && nAngle < 90)
Also, don't forget to declare your variable:
int angle;
Otherwise an error will show up on the line:
angle=nAngle;
Have fun!
21 years ago
Compile and run it and see what happens!
I forgot to mention:
The JDK or SDK is a download from Sun that will give you all the command-line tools to compile, run, document, and debug Java programs.
The RTE is a download that provides tools that work in the background when your web browser is running, so you can see applets and stuff. It also has the java command that lets you run class files from the command line.
The Sun 1 Studio is a seperate download that has a cool IDE in it. It includes the JDK/SDK.
21 years ago
You can't, unless you have the Java Virtual Machine installed on the computer you want to run the class on.
COMPILE ONCE means the program is compiled into bytecode that is in a .class file.

'RUN ANYWHERE' means that a Java .class file will run on any machine PROVIDED that machine has the Java Virtual Machine installed on it.
Sun makes the JVM for many different platforms available for free download. It's called RTE, or Run-Time Environment, which among other things, contains the JVM.
The JVM just sits there doing nothing until you type 'java myclassfile' on the command line.
Cool, ain't it?
21 years ago
The only thing that is different from one platform to another platform, one OS to another OS is the JVM. If you have a Mac with OS10, you must locate the JVM for that particular computer, download it, and install it. The MAC JVM is completely different from the PC/Windows JVM because it is designed and written only for a MAC. BUT, the two JVM's work the same way.
A good example is a Ford car and a Chevy car. Both are cars (like Macs and PC's are both computers), both have engines (like Mac's and PC's both have JVM's). Both cars work the same way, both perform the same function (like Mac's and PC's). But a Chevy engine only works in a Chevy car, and a Ford engine only works in a Ford car. Then say I give you a Chevy car without an engine. You want to make it go, so you must go out and find a Chevy engine and put it in.
Now you have a car with an engine. But there's no gas in it. You have to put gas in so you go to ANY gas station and put gas in it. In theory, all gasoline is exactly the same. You can go anywhere in the world, to any gas station and put gas in the car and make it go. The same is true for Java bytecode, which is what is inside class files. You can go to any web site that has Java applets, or run any java .class file on any machine that has it's version of a JVM on it, and make it go.
One of the few problems with Java is that it is VERY SLOW. Because the JVM must step through the bytecode in the class files, interpret the code, then perform the actions the bytecode calls for, it is very slow. All interpreted languages are slow. Visual BASIC traditionally is an interpreted language. COMPILED languages like C++ are very fast in comparison. C++ generates an executable .exe file that runs without an interpretor. But for every different computer, you must compile the source code with a compiler and linker designed for that machine.
Cool, ain't it?
21 years ago