...<useless blather>...
Nothing in that post could be construed as the least bit helpful to the original poster's question.
...<useless blather>...
Nothing in that post could be construed as the least bit helpful to the original poster's question.
The equation for each of those line segments will vary and therefore the perpendicular will vary as well.
(using translate() and rotate() the entire thing becomes trivially easy, but I am assuming that your assignment will not allow that)
I assume that was added automatically when code completion filled in a method or interface for you?
If so, just replace that with your own code for the method. It's there as a placeholder so that if you don't fill in your own code, you will receive an UnsupportedOperationException when you call it.
It's not Java, obviously - it's gibberish.
It's not working for the reason that I mentioned at the bottom of your other "need help!!!!1!!!" thread on the same code. Obviously you didn't read it.
I didn't find much detailed documentation on the available parameters for code templates besides ${cursor} and ${selection} - even in the netbeans api docs themselves for the editor.codetemplates package.
File templates use ${name} for that, but it didn't work in the editor code templates.
Yes, your mid point is calc'd incorrectly. You need to calculate the point perpendicular to the line formed by p1 and p2 at it's midpoint to form an equilateral triangle with sides len/3 in length.
Do you see a getSelectedItem() in the Checkbox API? Would such a method even make sense for a checkbox?
Note, please place all code in [code] [/code] tags when you post and give your threads a more descriptive title than "Help!" (as you seem to title all of your posts).
Well
public void actionPerformed(ActionEvent e)
{
JFrame About = new JFrame();
JLabel label = new JLabel("Hello World");
About.getContentPane().add(label);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("About");
setVisible(true);
}
only one of those statements is calling a method on your "About" frame - the rest are acting on your current frame class. The errors of the last two posts just show a lack of attention rather than a lack of knowledge. If you have an error or improper behavior in the code, look at it critically and try to see why it could possibly be doing that before you post it.
As far as the blank menu, look at the super() calls in the constructors of the other menu actions and look at your own action class constructor.
You have declared the actionPerformed() method inside your constructor. You cannot declare methods within methods.
You can't declare "_aboutAction" as Action unless it implements the Action interface or extends AbstractAction, which your AboutAction does not.
This isn't a marketing forum for you.
Be aware that you have re-declared all of your class-level component variables in your init() method, so if you refer to any of those outside of init() you'll find they are null and none of your listeners will work as you expect.
It's not a question of which is more powerful. They are different things.
SQL Server is a database system. It stores, manages, and retrieves data.
ADO.net is a data access layer that provides an API to interact with data stored in many different formats, including SQL Server, though you could also connect to Oracle, Sybase, MySQL, and other database systems (and even non-database sources if you wish)
http://en.wikipedia.org/wiki/ADO.NET
You cannot store data in ADO.NET itself - you use it to access data stored in some other system.
Then why is it that my mother complains if I leave the lid up, but the seat down, and my girlfriend complains if I leave the both the seat and lid down?
Because women and their mother-in-laws (though not officially in your case) can rarely agree on anything and the man is just the rope in this little tug-of-war between them?
No one said the rules were fair, but putting down the toilet seat is a small price for peace :P
The first time your wife sits into the toilet in the middle of the night after you left the seat up, you will not forget to put it back down again...
:P
I assume you are running it in the AppletViewer? I think that close button is part of a window created by the applet viewer itself. Since applets are designed to run in a browser, they don't really have a close button themselves. They have life cycle methods that respond to browser events, like leaving the page or closing.
http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html
You will probably need to put that action code in one of those life cycle methods.
(I've never had use for an applet personally so I would just imagine that would be the place to handle it)
If you can use them, key bindings are easier to handle with regards to focus:
http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html
but if you can't use those then you could call requestFocusInWindow() on the JApplet (or whatever other container you need to have focus) at the end of your button listener code
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JOptionPane;
public class FocusTest extends JApplet {
JButton button;
public void init() {
button = new JButton("Ok");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestFocusInWindow();
}
});
setLayout(new BorderLayout());
add(button,BorderLayout.SOUTH);
setFocusable(true);
addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
JOptionPane.showMessageDialog(FocusTest.this, "Key pressed");
}
});
}
}
None of this makes the least bit of sense.
Alex, the point was to keep in mind that other classes in the JDK, such as Runtime, System, the class loader, etc. are also allocating and using objects and primitives internally. The total memory reflects all of those things, not just the ones you are creating in your own code directly.
> ok, but why would bluej do things differently?
I really couldn't say. Netbeans and BlueJ both are interacting with the JVM when they run your program and freememory and totalmemory make no distinctions about the specifics or source of that allocation. If you want to examine the specifics you need to be working with heap dumps instead of raw aggregate memory numbers like those.
If you look at a heap dump taken on the last line of main(), at which you print the memory, you'll see where that extra memory is going:
There is a lot of stuff on the heap beyond those three objects you are looking at.
ok, guys, I had my word in it, I will leave you to never disturb you. Bye
This is a pretty clear indication that she just wanted to come back and make a scene.
@ezzeral
>yield further estrangement....i find this a bit strange. and at the risk of "yielding some estrangement" myself i have to ask what you are trying to say.
I am saying that by coming back and posting an introduction with such an confrontational and accusatory manner, she is more likely to provoke a negative reaction and possibly a repeat of the events that led to her previous experience.
if she was kicked off for no reason does she not have the right to find out what was going on?
Perhaps, but the Community Introductions forum is not really the place to address. A PM to a moderator would be much more appropriate than posting accusations in a general introduction thread.
I second all of those who said let the past stay in the past. perhaps some mistake was made. perhaps someone had a grudge and now it is in the past. forgetting it for that reason would be wise.
This was also part of my point. Had she merely re-registered and posted in a civil, friendly manner, the past never would have even come into it all. How would anyone even know of her previous troubles? Obviously, she preferred to make a spectacle of it instead.
You are welcome to post specific questions as you run into problems, but no one is going to complete this for you.
There is a somewhat convoluted example from the Swing tutorial here: http://java.sun.com/docs/books/tutorial/uiswing/examples/components/DialogDemoProject/src/components/CustomDialog.java
(It's a Java file so you may have to download it)
Here is a simpler, more direct example that I slapped together. Perhaps it will help:
import java.awt.Container;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JRadioButton;
public class CustomDialog extends JDialog{
JRadioButton button1;
JRadioButton button2;
public CustomDialog(Frame owner){
// create a modal dialog that will block until hidden
super(owner, true);
Container contentPane = getContentPane();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
button1 = new JRadioButton("First thing");
button1.setSelected(true);
contentPane.add(button1);
button2 = new JRadioButton("Second thing");
contentPane.add(button2);
ButtonGroup bGroup = new ButtonGroup();
bGroup.add(button1);
bGroup.add(button2);
JButton btnOk = new JButton("Ok");
btnOk.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// This will "close" the modal dialog and allow program
// execution to continue.
setVisible(false);
dispose();
}
});
contentPane.add(btnOk);
pack();
}
public String showDialog(){
// show the dialog
// this will block until setVisible(false) occurs
setVisible(true);
// return whatever data is required
return button1.isSelected() ? button1.getText() : button2.getText();
}
public static void main(String[] args) {
CustomDialog dialog = new CustomDialog(null);
String userChoice = dialog.showDialog();
System.out.println("User chose: "+userChoice);
}
}
"Acting further" will most likely only yield further estrangement and perhaps another banning. You have no implicit "rights" here on a privately owned forum beyond those extended to you by the administrators and moderators and any dignity you reap is dependent on what you sow.
Perhaps you should consider that coming back as a new user, interacting in a civil manner without repeating the things that got you banned in the first place, and not bringing attention to the problems you caused earlier would be a much wiser manner in which to rejoin the community.
Not exactly a good way to make a fresh start, I would say.
Ask them?
hai friend .. i have seen ur msg.... can u share ur coding on online share trading system.....
No, "u" must do "ur" own coding. If you turn in someone else's code for your project you deserve to fail.
Have you tried it?
Spamming your own thread won't get you help any sooner - just the opposite I would wager. Also, "plz" is not a word. Read the forum rules regarding use of proper English. This is not a chat room.
Well, you don't show whatever code "c1.menu1();" is executing, but you can only have one ResultSet open per Statement. You can have multiple Statement objects for a Connection though. Most likely you are re-using the Statement that created "Rmenu".
A few other things to note:
- This is the Java programming forum, but there is a separate forum for JSP and these questions are best directed there.
- You should not have so much Java code in your JSP page. Beans and Servlets should be handling those things.
Consider yourself lucky that you can't install it then. :P
Learn a lot more programming and signal processing, as speech recognition is far from trivial to implement.
Why would you not ask your colleague, seeing as he wrote the API?
In the future, please post your question before the wall of code, so people don't have to scroll past it all before they even know what you are asking about.
A HashMap would also serve well for that, with each letter for a key and the code for the value. A for-each on the map entries with String.replaceAll() against the string would process the entire text.
Nuh-uh. JCreator Lite doesn't recognize it as a statement. I tried
s = new Subscriber[n];
that is losing the double brackets and it worked.
Yes, copy-paste oversight on my part, but you got the point I suppose. Thanks for sharing that enlightenment.
Thanks for trying, anyway.
:-/
You bet. I'll not waste any more of your time "trying", since you're short on that.
The only place in which s[] is initialized is within the if (onClick.getSource() == MenuFrame.cmdSubscribe)
block, and it eclipses the class level variable with a local declaration. None of the other blocks initialize s[]. That array must be initialized prior to use, whether it be in the action listener blocks or another method, and glancing at those blocks in the listener, I'd say you need to change the declaration on line 49 to an initialization of the class level s[] variable like so
s[] = new Subscriber[n];
The warning that it might not be initialized comes from the fact that s[] will only be assigned a value in a conditional block and the compiler sees that it won't have a value if any of the other conditional blocks execute before it.
That can be resolved by initializing s[] to a particular value when you declare it, such as
Subscriber s[] = null;
// or
Subscriber s[] = new Subscriber[0];
Initializing to a size of 0 is usually a better way to go, since any loop operations on the array will simply not execute under the standard looping idiom of
for (int i=0; i<s.length; i++){}
Sure, it's not limited to specific methods, though if you are wanting to override quite a few or manage complex state, it is usually better to just go ahead and declare a normal inner class (or top-level if it would be useful outside the context of the containing class).
Often anonymous inner classes are used for "function objects" that specify a single method implementation, like actionPerformed() for a button listener. Such usage can be considered similar to function pointers in C++.