953 Posted Topics
Re: 1) don't use plain JTextField or JFormattedTextField use JSpinner instead, starting with quite safe SpinnerDateModel 2) use JWindow for popup Window, forgot to JPopup 3) there no issue with place un-decoratef JDialog or Jwindow to the absolute Point on the screen | |
Re: Swing JComponets are designated to use [URL="http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html"]KeyBinding[/URL] rather than KeyListener, 1) you can ignore [URL="http://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html"]Focus and Focus SubSystem[/URL] (both came from Native OS and is asynchrounous) 2) you can override system reserved Keys 3) more code easilly and confortable that catching Focus somewhere in the Screen 4) for KeyListener you … | |
Re: for better help sooner please post an [URL="http://sscce.org/"]SSCCE[/URL], that demonstraded your issue with Icon, not your code | |
Re: what's your question | |
Re: why remove/add same JComponents on Runtime, remove all code lines and replace that with myLabel.setIcon(img) then there no reason for very hard and long events as are revalidate(); with repaint(); if you have problem with image repaint in the Jlabel then change that with flush() myIcon.getImage().flush(); myLabel.setIcon(myIcon); more about [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html"]Icon[/URL] … | |
Re: and don't mixing AWT Applet with Swing Methods, use todays JApplet rather than pre-historic Applet | |
Re: [URL="http://stackoverflow.com/questions/8514082/model-addrow-change-background-color"]crossposted[/URL] | |
Re: for why reason(s) you needed that, in the JTable is there by default JLabel, on CellEdit is there JTextField | |
Re: @berniefitz agreed +1 I'd suggest to look at [URL="http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html"]CardLayout[/URL] rather than [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html"]JTabbedPane[/URL], | |
Re: 1) maybe hepl us to ask question 2) sure code would to help us 3) [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/list.html"]JList[/URL] and [URL="http://www.java2s.com/Tutorial/Java/0240__Swing/0720__JList.htm"]JList[/URL] | |
Re: my question about [URL="http://stackoverflow.com/questions/6576028/mysql-interpreter-refuse-filtering-char-varchar-contains-backslashes"]BackSlashes[/URL] | |
Re: 1) pure and plain Java ??? 2) File is runnable ??? 3) File is compiled to the MyName.jar (for example) ??? 4) there any recomplication/decompilation/Compilation ??? 5) if for all four questions is your answer onnly word YES, then yes that's possible, and you're proceed to the next round | |
Re: Ezzaral since I up-voted your post still I think that not easy to do as you said [url]http://stackoverflow.com/a/6993818/714968[/url] | |
Re: [URL="http://stackoverflow.com/questions/8382430/making-gpa-calculator-in-java-need-a-little-adjusting-to-finish-it"]crossposted[/URL] | |
Re: [CODE]int returnVal = JOptionPane.showConfirmDialog(display, "Bla Bla Bla Text"); if (returnVal == JOptionPane.OK_OPTION) { field1.setText("SELECTED - OK btn"); } else if (returnVal == JOptionPane.NO_OPTION) { field1.setText("SELECTED - NO btn"); } else if (returnVal == JOptionPane.CANCEL_OPTION) { field1.setText("SELECTED - Cancel btn"); } else if (returnVal == JOptionPane.CLOSED_OPTION) { field1.setText("SELECTED - Close btn"); … | |
![]() | Re: 1) that was (I'm sure that closed) bug about JPopupMenu 2) add parent is always safiest way how to do ... whatever [CODE]JOptionPane.showMessageDialog (myParent , "Test Message #" + j_F , "Message Title #" + j_F , JOptionPane.INFORMATION_MESSAGE);[/CODE] otherwise is JOptionPane dispayed on 1st. device to the CENTER location 3) … ![]() |
Re: 1) not possible, without huge code for AWT workaround 2) you are talking about JFrame#setDefaultCloseOperations(JFrame.EXIT_ON_CLOSE) with 3 JDialogs##setDefaultCloseOperations(JDilaog.DISPOSE_ON_CLOSE) 3) don't do it that this way its so hard job manage anything betweens four hight level container, you have to put there some hierarchy, result is JFrame as parent with three … ![]() | |
Re: agreed with Ezzaral for safiest way only to add flush method e.g. myIcon.getImage().flush(); then add Icon to JLabel myLabel.setIcon(myIcon); | |
Re: [URL="http://www.java2s.com/Code/Java/Swing-Components/AutocompleteComboBox.htm"]Auto complete ComboBox / JFextField[/URL] is best workaroound as I know, there are two java classes (required both for success), 1st. for JComboBox, 2nd for JTextField, check for methods setStrict(boolean b) and setDataList(ArrayList) | |
Re: @hfx642 +1 I strongly recommend to use JDialog/JWindow as another Container, there are lots of common issues with usage two (or more) JFrames in same time, starting with FocusRecycle, toFront .... | |
Re: 1) use [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html"]Icon[/URL] in the [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/label.html"]JLabel[/URL] for Image/IconImage instead of paint() 2) for Swing use paintComponent rather thatn paint(); | |
Re: add Items to the [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/list.html"]DefaultListModel[/URL] | |
Re: 1) I think that you have look at [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html"]WindowListener[/URL], very simple example for plain vanilla Swing [URL="http://stackoverflow.com/q/7082054/714968"]here[/URL] 2) don't use Netbeans or any Built-in GUI wrapper, learn [URL="http://docs.oracle.com/javase/tutorial/uiswing/index.html"]plain vanilla Swing[/URL], because lots of methods (talking anout fun from coding and clear head) are depreciated or not implemented in these Frameworks … | |
Re: [CODE] JFrame window = new JFrame(); window.setTitle("Pos Setup Tool 0.1 Alfa"); //window.setSize(800, 600); window.setResizable(false); JPanel sidebar = new JPanel(new BorderLayout()); sidebar.setPreferredSize(new Dimension(250, 600)); sidebar.setBackground(Color.black); JTree tree = buildTree(); JScrollPane sidebar_placement = new JScrollPane(tree); sidebar.add(sidebar_placement); window.add(sidebar, BorderLayout.CENTER); window.pack(); window.setVisible(true);[/CODE] | |
Re: your problem is setSize(FRAME_WIDTH, FRAME_HEIGHT);, then JFrames childs fills all empty space into Container, | |
Re: that same as if you implements e.g. ActionListener | |
Re: [URL="http://stackoverflow.com/questions/8203628/how-to-add-a-jfreechartpie-chart-to-a-panel-in-netbeans"]crossposted[/URL] | |
Re: [URL="http://www.daniweb.com/software-development/java/threads/392789/1689145#post1689145"]JButton#setContentAreaFilled(false);[/URL] | |
Re: build Swing GUI in Event Dispatch Thread, Swing GUI must be done in EDT delaying Swing GUI in EDT more about technical ... in [URL="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html"]Concurency in Swing[/URL] | |
Re: [URL="http://stackoverflow.com/questions/8107903/passing-input-from-jbutton-to-console"]crossposted[/URL] | |
Re: you have to add some JComponent to the JFrame, then add MouseXxxListener to this JComponent | |
Re: that about how to [URL="http://download.oracle.com/javase/tutorial/uiswing/layout/index.html"]LayoutManagers[/URL] works, for example [CODE]import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class TestResizeFrame extends JFrame { private static final long serialVersionUID = 0; static final int INNER_WIDTH = 320; static final int INNER_HEIGHT = 320; private OvalPanel panel = new … | |
Re: [URL="http://download.oracle.com/javase/6/docs/api/javax/swing/AbstractButton.html#setContentAreaFilled%28boolean%29"]JButton#setContentAreaFilled(false);[/URL], [CODE]import java.awt.*; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import java.util.LinkedList; import java.util.Queue; import java.util.Random; import javax.swing.*; //http://stackoverflow.com/questions/7943584/update-jlabel-every-x-seconds-from-arraylistlist-java public class ButtonsIcon extends JFrame implements Runnable { private static final long serialVersionUID = 1L; private Queue<Icon> iconQueue = new LinkedList<Icon>(); private JLabel label = new JLabel(); private Random random = new Random(); private … | |
Re: change JTextField to the [URL="http://download.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html"]JFormattedTextField[/URL] with number formatter, then change expr.setText( expr.getText() + ""+i ); to expr.setValue(((Number) expr.getValue()).doubleValue()+ i); | |
Re: put Icon to the JButton directly | |
Re: [CODE]private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { int selectedIndex = jList1.getSelectedIndex(); // if isn't there any row selected, then jList1.getSelectedIndex() returns -1 if (selectedIndex != -1) { // or selectedIndex > -1 jList1.remove(selectedIndex); } }[/CODE] | |
Re: you can use Focus, but for JTextComponent is there DocumentListener + Caret for JTextArea myTextArea.setCaretPosition(textArea.getDocument().getLength()); | |
Re: what do you want to fix, I miss there question | |
Re: this C# code isn't good too | |
Re: [URL="http://stackoverflow.com/questions/8043107/a-jlist-scoll-pane-program-that-reads-from-a-file"]crossposted[/URL] | |
![]() | |
Re: check this [URL="http://www.daniweb.com/software-development/java/threads/384072"]thread[/URL] | |
![]() | Re: [URL="http://stackoverflow.com/search?q=user%3A714968+jslider"]maybe[/URL] |
Re: [URL="http://stackoverflow.com/questions/8018333/java-classes-interface-and-gui"]crossposted[/URL] | |
Re: use an Arrays of JButtons[] (starts with zero ==0 ), in this case you doesn'd care about return value, because JButton[0] will returns always 0 value, change JTextField to the JFormattedJTextField with Number Formatter, then can add only [0-9] and decimal separator, you have to look for Nested layout (free … | |
Re: [CODE]import java.awt.*; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import java.util.LinkedList; import java.util.Queue; import java.util.Random; import javax.swing.*; //http://stackoverflow.com/questions/7943584/update-jlabel-every-x-seconds-from-arraylistlist-java public class ButtonsIcon extends JFrame implements Runnable { private static final long serialVersionUID = 1L; private Queue<Icon> iconQueue = new LinkedList<Icon>(); private JLabel label = new JLabel(); private Random random = new Random(); private JPanel … ![]() | |
Re: for [URL="http://download.oracle.com/javase/tutorial/uiswing/components/combobox.html"]JComboBox[/URL] is better to implements [URL="http://download.oracle.com/javase/tutorial/uiswing/events/itemlistener.html"]ItemListener[/URL], and fired always twice (SELECTED and DESELECTED) | |
Re: you have to use [URL="http://download.oracle.com/javase/tutorial/uiswing/layout/index.html"]LayoutManager[/URL], because anything layed by using NullLayout is by default non-resiziable |
The End.