1. Help with knowing which button number was pressed stackoverflow.com
|
2. How to have program wait for a button press in Java stackoverflow.comNow, I'm not sure if this is possible or even the best way to accomplish what I'm trying to do, but basically I'm creating a very simple simulation program with a ... |
3. Press [X] button to close JFrame won't invoke dispose method stackoverflow.comI have set up a JFrame like this:
|
4. Java Swing: Can I set a button mnemonic that doesn't require pressing alt? stackoverflow.comFor example, say I have a series of toolbar-style buttons across the top of my application's main window. I want to attach a mnemonic to one of these that's just ... |
5. change a frame's attribute by pressing a button stackoverflow.comSuppose we have a JFrame named frame1 with a String attribute named credentials set inittially to null. I have a jButton named button1 attached to the frame and I want to ... |
6. Java drawOval after random time when user pressed Jbutton stackoverflow.comSo when the user presses my JButton, it picks a random time, and after that time, it will draw a oval to the screen. However, with what I have now, it ... |
7. How to print a page when a JButton is pressed in java swing using PrinterJob? stackoverflow.comI tried the following code AWT but at runtime shows multiple print dialogs repeatedly....
|
8. Manipulating a JToggleButton's ImageIcon while pressed/selected stackoverflow.comI (very miraculously) answered my own question while writing this question , but it was such a find I wanted to share with everyone. I understand these should be true ... |
9. Need a solution to press a button in the first jframe and it transfers me to another jframe stackoverflow.comI'm using netbeans for Java and I have created a file including 2 JFrames and I have placed a button in the first JFrame , and I want to know ... |
10. Java set focus on jbutton when pressing enter stackoverflow.comHow can I make it so that when I press enter in a JTextField it activates a specific JButton? What I mean is something along the lines of a web page ... |
11. what button is pressed java stackoverflow.comthere is possible to recognize whst btn is pressed with a unique eventListener? i tried this code, but didn't work
|
12. How to modify Nimbus L&F to activate the default button when pressing the Enter key? stackoverflow.comIn the Nimbus L&F when one presses the Enter key, if a button has focus, that button is clicked whether or not another button has been set as default as in:
Also, ... |
13. Which button of JSpinner has been pressed? stackoverflow.comIs it possible to know , from inside a ChangeListener receiving a ChangeEvent from a JSpinner, which button (increment/decrement) has been pressed? |
14. how to pause program until a button press? stackoverflow.comi use from a class that extended from jframe and it has a button(i use from it in my program) i want when run jframe in my program the whole of my ... |
15. Count how many times a JButton is pressed? stackoverflow.comIn the action performed code in a JAVA GUI, how would I count how many times a button is pressed, and do something different for each press of the button?
|
16. How to find in Java if JToggleButton is pressed stackoverflow.comHow to find in Java if JToggleButton is pressed and if it is pressed to set to be unpressed ? |
17. JButton "stay pressed" after click in Java Applet stackoverflow.comI have a JButton in my Java Applet. After pressing it, ActionListener have to make huge amount of actions. So, because of it, when user clicks the button, it "stay pressed" ... |
18. How to make Scrollbar of scroll pane make movable autimatically with the cursor as we press TAB Button on keyboard? stackoverflow.comI have following code. After executing following code It shows an JFrame containg A JInternalFram which has a JScrollPane This JCrrollPane has a JPanel has many input controls. As the size ... |
19. Java : Swing : Hide frame after button pressed stackoverflow.comI have a button in a java frame that when pressed it reads a value from a text field and uses that string as a port name attempting to connect to ... |
20. Swing JToolbarButton pressing stackoverflow.comI use JToolbarButton button, I want to make it be "pressed" when I click on it, just like JButton works.How can I do this? Please help!Thanks. |
21. Test if a javax.swing.JButton is pressed down stackoverflow.comI would like to check whether a certain |
22. How to keep a JButton pressed after its JPanel loses focus stackoverflow.comI have found how to keep a JButton in its pressed state using this code:
|
23. Choose what an array stores based on button press stackoverflow.comI'm trying to find a way to pick what an array stores based on which button the user presses on a GUI. for example
|
24. GUI - Change contentpane when button pressed bytes.comThanks for the help! but... Do you know where I can read up more of the pack method? It sort of does what I want but I'll have more than 1 ... |
25. jButtons backgound colour while pressed forums.netbeans.orgI'm getting a bit discouraged posting in these forums, I don't often seem to get answers to my questions (don't know why...), but hopefully someone can help with this: I have ... |
26. Need help to reset a jFrame when a button is pressed. forums.netbeans.orgHi everyone I want to know if there is some code that will clear/reset a jFrame when a button is pressed. I need it so that it clears it each time ... |
27. Pressing HotKeys of a jbuttons simultaneousl forums.netbeans.orgHI I created two buttons with hot keys like Button1 as back.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), "backActionPerformed"); back.getActionMap().put("backActionPerformed", new AbstractAction("backActionPerformed") { public void actionPerformed(ActionEvent evt) { backActionPerformed(evt); } } ); and second button like ... |
28. JButtons, Key Press, and Obervers, et al coderanch.comFirst the question, then the reason I am asking ... in case you want to know! In the update method of the observer interface, it will tell you the source of the observerable object. public void update(Observable source, Object state) Can someone tell me what exactly the 'source' is telling me? For example, what do I need to do to differentiate ... |
29. JButton pressed appearance coderanch.com |
30. How to know "PrintScreen" button pressed ???? coderanch.com |
31. JButton (pressed state) coderanch.com |
32. Activating a button when pressing enter coderanch.com |
33. playing sounds when button is pressed coderanch.com |
34. How to perform Calculation when a button a pressed in a Frame coderanch.com |
35. Press ENTER and ignit activate the button coderanch.com |
36. How i can play a wav file when a button pressed coderanch.comimport javax.swing.*; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.io.*; class Testing extends JFrame implements ActionListener { JButton btn = new JButton("Play Sound"); File wavFile = new File("c:\\Windows\\media\\ding.wav"); AudioClip sound; public Testing() { setSize(300,100); setLocation(400,300); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel jp = new JPanel(); btn.addActionListener(this); jp.add(btn); getContentPane().add(jp); pack(); try{sound = Applet.newAudioClip(wavFile.toURL());} catch(Exception e){e.printStackTrace();} } public void actionPerformed(ActionEvent ae){sound.play();} public static void main(String args[]){new Testing().setVisible(true);} ... |
37. switching between different JPanels when pressing buttons coderanch.comI have a problem when trying to switch to a different JPanel when you press another button on a toolbar. The panel does not show up until I resize the window or let a JTextArea appear instead of a JPanel. More specifically: the btnStakes currently places a JTextArea in BorderLayout.CENTER, wich works right away. The btnContacts places my own JPanel in ... |
38. Why is InputVerifier allowing button to be pressed coderanch.com |
39. Open a new window to the press of a button coderanch.com |
40. Pressing a button to open a new window coderanch.comHi im developing an application about a repair shop for automotive vehicles with a connection to a DB. Waht i want to do is this :i have my button "New Client" and im trying to do that when i press the button , it opens a new window (i think it would be a new JFrame) where it will be the ... |
41. Which JButton is being pressed ? OK or Cancel ? coderanch.comHi! Well creating an inner-class like this: private class KeyBoardListener implements KeyListener{ public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} } I only get to know if I have punched the 'enter'-key on the keyboard, but I do not know if I have tabbed to the 'ok'-button or the 'cancel'-button. So how do I ... |
42. Problem in Shift button keyPressed event coderanch.comHi, I have a problem during the shift key presse event on the text box. Whenever I press Shift + 8 key the key that is displayed is Shift + *. But I want Shift + 8 to be displayed. Can anyone please tell me the solution to this problem. - Thanks in advance [ October 08, 2008: Message edited by: ... |
43. button press -> +1 coderanch.comThink something was misunderstood, I don't see any need for a Jbutton. I just want to change the value of a variable when a key on the keyboard is pressed. I was thinking that key bindings would be the answer but I can't seem to understand what it does and I can't find a code that contains what I need. |
44. Component having focus before button is pressed coderanch.com |
45. Pressing ENTER when Button is selected doesnt fire buttonActionPerformed... coderanch.comOk I wil try to explain my problem again: I have a form with 3 buttons and 2 textfields. BUTTONS: Login, New user..., Exit. What I want to do is to set ENTER to fire Login button no matter on which component focus is on, except two buttons New user... button and Exit button. And also I want to set ESC ... |
46. JToggleButton - pressing and selecting through software coderanch.com |
47. How to press JButtons from within the program? coderanch.com |
48. Press a button and draw a shape coderanch.comI have the following code shown below, which will be able to draw a shape once clicking on a button. For example, if you press the "Draw Rectangle" button a rectangle should be drawn and so forth. I have reached to the point where to determine the button pressed, but UNABLE to add the drawing functionality after that. How can I ... |
49. How to make a button stay look like pressed? coderanch.comThank you for the hint. After I read that setPressed() should've worked I looked at the buttons very closely and actually I think it did - but the difference is barely visible... the buttons are made to look slightly pressed which is barely noticeable and they don't retain that blue shade which appears when I actually press a mouse button on ... |
50. How to set focus on submit button on press of enter key coderanch.comHello Rob, Theoratically it sounds good, but i have been trying the same for the last few days, So please if you could provide some example or link where i can get practical clue. As i am not very expert and unbale to find how table behaves when entered is pressed and how table identifies the first and last row to ... |
51. Too many ActionEvents after button press. coderanch.comHello. I have a class called Stats, which is responsible for keeping track of the statistics in my minesweeper game, it's also responsible for saving and loading these statistics. It also has a method called showStatsGui() which pops up a JDialog which contains labels that show the stats and also a reset button. When using the application the user clicks on ... |
52. Long pressed jbuttons coderanch.comimport java.awt.Dimension; import java.awt.GridBagLayout; import javax.swing.*; public class LongPressedButton { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new LongPressedButton().makeUI(); } }); } public void makeUI() { JToggleButton button = new JToggleButton("I'm a long, pressed button", true); button.setPreferredSize(new Dimension(800, button.getPreferredSize().height)); JFrame frame = new JFrame(); frame.setLayout(new GridBagLayout()); frame.add(button); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1000, 100); frame.setLocationRelativeTo(null); frame.setVisible(true); } } |
53. Draw shapes by pressing a button java-forums.orgI have the following code shown below, which will be able to draw a shape once clicking on a button. For example, if you press the "Draw Rectangle" button a rectangle should be drawn and so forth. I have reached to the point where to determine the button pressed, but UNABLE to add the drawing functionality after that. How can I ... |
54. Handle button press java-forums.orgHello, I'm working on a program which solves basic polynomial problems ( the addition of two polynomials , finding the roots...) On the GUI part, though, there's something I don't really know how to implement. I used the CardLayout and I have multiple cards ( for the addition of polynomials, the subtraction of polynomials and so on) each of them having ... |
55. Long pressed jbuttons java-forums.org |
56. How to change the JButton Pressed Color forums.oracle.comHi, I'm trying to change the Button pressed color and I haven't found any property to change it. How do I do to change this color?, is it necessary to change the color with a listener? do I need to create my own button to make it possible? or I need to create a mono-color Icon and then use it? Thanks, ... |
57. how to assign the enter pressing to the button click event of swing button? forums.oracle.com |
58. JButton stays pressed for 1 second, not what I want forums.oracle.com |
59. keep JButton pressed forums.oracle.com |
60. Trying to wait for a button press on a seperate JFrame- problems. forums.oracle.comWhy not use a modal JDialog here and not a JFrame. You probably shouldn't be coding directly to a JFrame (or JDialog) anyway but to a JPanel that can be placed on the proper root container of choice (which again here is a JDialog). You can make your JPanel as complex as desired, then place it in the JDialog, make that ... |
61. JFrame, button press opening new window forums.oracle.com |
62. GUI troubles (opening a new window when a button is pressed) forums.oracle.com1) You're talking about using buttons and on reacting to mouse clicks. Are you using a mouse listener on a JButton? If so, don't. They were built to use ActionListeners, and this is what you should use. 2) You may need to call setVisible(true) on your new Login window in order to see it. 3) Most importantly, go through the Sun ... |
63. Key_Pressed Link to JToggleButton forums.oracle.comWhat Michael is saying is that when a button has focus they you can use the space bar to invoke the ActionEvent of the button (ie. its the same as clicking on the button with the mouse). I have no idea what you are asking but I guess you should try reading the Swing tutorial on [How to Use Key Bindings|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html]. ... |