Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!

Angela Lamb

Ranch Hand
+ Follow
since Feb 22, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Angela Lamb

Didn't your first post say you were trying to sort an array of integers? What does the code you posted have to do with sorting?
Anyway, here is one way to count the number of times that a letter occurs in a sentence:
16 years ago
Use the getSelectedFile method instead. It will return a directory if that is what is selected. You can also use setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) to ensure that only directories may be selected.
16 years ago
Your listener class is choosing the action based on the action command of the button, but you never set this property for the toolbar buttons. Add these lines to your addToolbarButtons method and it will work:
jbutton.setActionCommand("Change User/Login");
jbutton.setActionCommand("Disconnect");
16 years ago
The "border" is showing up because your overridden paint method isn't written correctly. The background for the panel is never being changed. Just take the paint method out and add this line to your constructor:
this.setBackground(bg);
There's no need to override the paint method if the only thing you need to do is change the background.
Also, to explain why your paint method is not working - the setColor method of the Graphics object doesn't do anything other than setting the color for future painting. To actually paint the background, you would need to use something like the fillRect method.
[ June 04, 2002: Message edited by: Angela Lamb ]
16 years ago
Use the getLineOfOffset(int´┐Żoffset) function. The offset parameter will be the position of the '{' within your text.
16 years ago
Did you try using getBorderInsets(Component c) on your TitledBorder?
16 years ago
I think you are looking for something like this:

The object passed back by Class.forName is not actually an Uno, you need to use the newInstance method to create a new Uno object.
16 years ago
String fName = "some_filename";
File file = new File(fName);
FileOutputStream out = new FileOutputStream(file);
16 years ago
If you change your GridLayout to a GridBagLayout, then you could add your textfields and buttons directly to the background panel without them being resized. I think that would be a lot easier than trying to make a transparent panel.
16 years ago
You can use the setMargin function for this.
JTextField textField = new JTextField("test");
textField.setMargin(new Insets(10, 10, 10, 10));
16 years ago
All you need to do is use the setMnemonic function on your two menus. What exactly are you having problems with?
16 years ago
The enable method is deprecated as of version 1.1 - that's why it no longer works correctly. It has been replaced by the setEnabled method.
16 years ago
Here is your problem:

enable(true) needs to be changed to setEnabled(true)
16 years ago
Try this instead:
textArea.setCaretPosition(selStart.intValue());
textArea.moveCaretPosition(selEnd.intValue());
I think the setSelectionStart and setSelectionEnd methods will only work if there is already some text selected.
16 years ago