Agnes Lapka

Greenhorn
+ Follow
since Dec 26, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Agnes Lapka

Thanks, Marcos. I'm going to try that right away.
Thanks for your help. A.
23 years ago
Hi,
I'm new to servlets and I'm very confused.
I'm trying to write a servlet that will write data to Access Database. I have the Microsoft Access Driver which comes with Windows ( Settings -> Control Panel -> ODBC Data Sources ).
I thought I could use it in my servlet until I've heard that I must include the path to a JAR file containing the Driver in my CLASSPATH settings. Where can I get a JAR file with Access Driver? Can I use the Driver I already have or do I need to download a new one? I would be grateful for suggestions.
TIA - A.
23 years ago
Sure you can download Java. But that's no big deal. The real problem is IE. By the looks of it, MS is treating IE as part of the Windows XP O/S. And therefore, will not support it in IE. If so, if you use IE, you will not be able to see any site that uses Java. Goodbye java applets, and so on, for IE users. Given the browser market share IE has, that's a problem. The idea being that MS is trying to shift support to XML for their .Net strategy. With MS market dominance, this cannot be happy news either way. Comments?
23 years ago
http://dailynews.yahoo.com/h/ap/20010717/tc/microsoft_java_1.html
Microsoft XP Won't Include Java
By ALLISON LINN, AP Business Writer
SEATTLE (AP) - Microsoft Corp. (NasdaqNM:MSFT - news) will not include the Java programming language in its new Windows XP (news - web sites) operating system, the software giant said Tuesday.
?
23 years ago
Just one more thing...
Is there a way of letting the user decide in which directory they want to put those class files? Couldn't one write a small 'installation wizard' in some other language (that has exe files), store the path the user chooses and append it to the bat file?
I have absolutely no knowledge of those kinds of operations, so those questions might seem silly... But I'd like to know how professionals do it? Any ideas?
A.
23 years ago
Thank you for all your suggestions!
I'm affraid applet wouldn't do, because I'm accessing database from the my application ( I don't think applets can do that, unless I'm wrong...).
Cindy, your answer is exactly what I've been looking for!
Thanks!
A.
23 years ago
Hi Everyone!
I wrote a little program in Java and I'd like to give it to a few friends. My question is how do I do it? Since there are no exe files in Java, how would they run my little application? Do they need to install JVM and run it from the command line? That doesn't sound right... Please, give me some ideas...
A.
23 years ago
Hello , everyone!
Is it possible to add listeners to a JApplet, that would listen to the events generated in the JPanel which is attached to this JApplet?
Another words , how to make the JApplet listen the the events that happen in the JPanel which is a part of this JApplet?
I would be grateful for any suggestions.
TIA
23 years ago
Hello,
Max, Mike - thank you so much for helping me.
Mike, you are right - I simply misspelled the variable names. I can't believe this happened to me! Before I ask for your help, guys, I really try to make sure that there are no stupid mistakes like misspelled variable names in my code. This time I was deceived by the compiler message, so I didn't desk checked the code carefully enough. I'm really embarrassed...
Thank you for the advice on tracing the stack - I have Windows 98
and I'm going to make changes in my Control Panel right now!
I hope you have a good week!
A.
23 years ago
Hello,
Mike, Cindy, thank you so much for taking your time and trying to answer my question!
Mike, your driver works, so I made the Test class sightly more complex ( I want to add 3 text boxes and 3 sliders) and tried it out using your TestItOut and , again, it threw all kinds of exceptions... These have to do with 'events dispach' ( I'm new to Java, but I suspect it has something to do with multiply threads, right?). Now, that's disappointing... I can have
one slider with an event handler as an inner class, but I can't have three?
I realise that it all would be simpler with a JFrame, but extending JPanel is one of the assignment's specifications...
I was thinking of creating an 'intermediate' class, which would simply use 3 instances of Test, and I would get the three sliders and the three text boxes... I'm going to try this out, but it seems that this should not be the only option...
I would be grateful for any suggestions. Thanks again!
Here is the new Test:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Test extends JPanel {
private JSlider redSlider;
private JSlider blueSlider;
private JSlider greenSlider;
private JTextField redText;
private JTextField blueText;
private JTextField greenText;
GridLayout layout = new GridLayout(3,2);
public Test() { // constructor
//____________ set up JTextFields__________________
redText = new JTextField( " ", 10);
redText = new JTextField( " ", 10);
redText = new JTextField( " ", 10);
// ____________ set up JSliders ____________________

redSlider = new JSlider( SwingConstants.HORIZONTAL,
0, 225, 10);
redSlider.setMajorTickSpacing(10);
redSlider.setPaintTicks(true);
redSlider.addChangeListener(
new ChangeListener() {
public void stateChanged( ChangeEvent e)
{ redText.setTex(" "+
redSlider.getValue() );
repaint(); }
}
);

blueSlider = new JSlider( SwingConstants.HORIZONTAL,
0, 225, 10);
blueSlider.setMajorTickSpacing(10);
blueSlider.setPaintTicks(true);
blueSlider.addChangeListener(
new ChangeListener() {
public void stateChanged( ChangeEvent e)
{ blueText.setText(" " +
blueSlider.getValue() );
repaint(); }
}
);

greenSlider = new JSlider( SwingConstants.HORIZONTAL,
0, 225, 10);
greenSlider.setMajorTickSpacing(10);
greenSlider.setPaintTicks(true);
greenSlider.addChangeListener(
new ChangeListener() {
public void stateChanged( ChangeEvent e)
{ greenText.setText(" " +
greenSlider.getValue() );
repaint();}
}
);
setLayout( layout);
add(redSlider);
add(redText);
add(greenSlider);
add(greenText);
add(blueSlider);
add(blueText);

} // end of constructor
} // end of class Test
.. and here is your driver, Mike:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class TestItOut extends JFrame{
private Test t;
private JButton btn;
private JFrame temp;
public TestItOut() {
super("Testing a dialog");
Container c = getContentPane();
c.setLayout(new FlowLayout());
btn = new JButton("Click Here");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
temp = new JFrame("Second Window");
t = new Test();
temp.setContentPane(t);
temp.setSize(200,200);
temp.setVisible(true);
System.out.println("Click");
}
}
);
c.add(btn);
setSize(200,200);
setVisible(true); }
public static void main(String args[]) {
TestItOut app = new TestItOut();
app.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0); } }); }}

23 years ago
Hello, Everyone!
I�m trying to create a subclass of JPanel that will contain 2 JCompontents: a JSlider and a JTextField.
It�s supposed to be a reusable class, so I�ve been trying to build the complete interface in the constructor.
The problem I�m having is that when I attach the components to the panel ( the last two lines of the constructor) and run the program which uses this class, I�m getting the NullPointerException. Is it because the object of this class is just being instantiated, so I can�t refer to it (even implicitly)?
In that case, where exactly should I attach the two components to the panel?
I will be infinitely grateful for help.
Here is the class:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Test extends JPanel {
private JSlider slider;
private JTextField text;
FlowLayout layout = new FlowLayout();
public Test() { // constructor
text = new JTextField( " ", 10);
slider = new JSlider( SwingConstants.HORIZONTAL,
0, 225, 10);
slider.setMajorTickSpacing(10);
slider.setPaintTicks(true);
slider.addChangeListener(new ChangeListener() {
public void stateChanged( ChangeEvent e)
{ text.setText(" " + slider.getValue() );
repaint(); }
}
);
setLayout( layout);
// these two lines create a problem:
add(slider);
add(text);

} // end of constructor
} // end of class
and here�s the error message that pops up when I try to run it:
Exception (...)java.lang.NullPointerException
At java.awt.Container.addImpl(Container.java:345)
At java.awt.Container.add(Container.java:228)

23 years ago
Hello, Everyone!
I�m trying to create a subclass of JPanel that will contain 2 JCompontents: a JSlider and a JTextField.
It�s supposed to be a reusable class, so I�ve been trying to build the complete interface in the constructor.
The problem I�m having is that when I attach the components to the panel ( the last two lines of the constructor) and run the program which uses this class, I�m getting the NullPointerException. Is it because the object of this class is just being instantiated, so I can�t refer to it (even implicitly)?
In that case, where exactly should I attach the two components to the panel?
I will be infinitely grateful for help.
Here is the class:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Test extends JPanel {
private JSlider slider;
private JTextField text;
FlowLayout layout = new FlowLayout();
public Test() { // constructor
text = new JTextField( " ", 10);
slider = new JSlider( SwingConstants.HORIZONTAL,
0, 225, 10);
slider.setMajorTickSpacing(10);
slider.setPaintTicks(true);
slider.addChangeListener(new ChangeListener() {
public void stateChanged( ChangeEvent e)
{ text.setText(" " + slider.getValue() );
repaint(); }
}
);
setLayout( layout);
// these two lines create a problem:
add(slider);
add(text);

} // end of constructor
} // end of class
and here�s the error message that pops up when I try to run it:
Exception (...)java.lang.NullPointerException
At java.awt.Container.addImpl(Container.java:345)
At java.awt.Container.add(Container.java:228)
23 years ago
Hi Everyone,
I've been trying to locate a method that returns a Unicode value of a String ( an int) - so far unsuccessfully. I found one that returns a Unicode value of a character(getNumericValue), but I would have to break the String into characters before I were to use it, which sounds like too much work.
Any suggestions? Thanks in advance.
A.
23 years ago
Hello Everyone,
I have some doubts regarding the following issue:
If class B extends class A, does a class A object get created when we instantiate a class B object?
Does the object get created when the constructor is called or is it created only when �new� is used?
Bruce Eckel writes:
�When you create an object of the derived class, it contains within it a subobject of the base class. This subobject is the same as if you had created an object of the base class by itself. It�s just that, from the outside, the subobject of the base class is wrapped within the derived-class object.�
Does it mean that when we instantiate the object of the derived class, we end up with both an instance of a derived class and instance of the base class?
I�d appreciate if someone could explain this to me, please.
TIA
A.
23 years ago
Karan, thanks for responding.
I'm afraid , that putting showStatus in init() doesn't help - I tried ( I checked the syntax of this method and I did use it correctly). The problem was that the message I displayed in the status bar (in init() ) showed up for a fraction of a second and got wiped out but 'Applet started'.
I had to use paint() and repaint() because I needed to draw on the Applet as well.
Anyway, I resolved this problem thanks to Manfred from the Applets message board.
He suggested that I use super.paint() in paint(). And it works!
Both the interface created in init() and the message in the status bar show up.
The only problem is that the messages I paint on the applet are flickering. I understatnd this is due to the use of repaint(), but I have to use it. I don't know how to get rid of this problem...
24 years ago