953 Posted Topics

Member Avatar for Majestics

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

Member Avatar for Majestics
0
98
Member Avatar for Skretch

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 …

Member Avatar for Skretch
0
352
Member Avatar for varun45

for better help sooner please post an [URL="http://sscce.org/"]SSCCE[/URL], that demonstraded your issue with Icon, not your code

Member Avatar for varun45
0
990
Member Avatar for pushpap7
Member Avatar for crazymidget01

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] …

Member Avatar for mKorbel
0
1K
Member Avatar for Swirly

and don't mixing AWT Applet with Swing Methods, use todays JApplet rather than pre-historic Applet

Member Avatar for NormR1
0
212
Member Avatar for nsyncpilu

[URL="http://stackoverflow.com/questions/8514082/model-addrow-change-background-color"]crossposted[/URL]

Member Avatar for nsyncpilu
0
1K
Member Avatar for kusumadas

for why reason(s) you needed that, in the JTable is there by default JLabel, on CellEdit is there JTextField

Member Avatar for mKorbel
0
98
Member Avatar for Nandomo

@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],

Member Avatar for jazz_vill
0
143
Member Avatar for singhs18

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]

Member Avatar for singhs18
0
178
Member Avatar for newbie14

my question about [URL="http://stackoverflow.com/questions/6576028/mysql-interpreter-refuse-filtering-char-varchar-contains-backslashes"]BackSlashes[/URL]

Member Avatar for thines01
0
189
Member Avatar for Majestics

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

Member Avatar for mKorbel
0
114
Member Avatar for sirlink99

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]

Member Avatar for mKorbel
0
171
Member Avatar for jprince

[URL="http://stackoverflow.com/questions/8382430/making-gpa-calculator-in-java-need-a-little-adjusting-to-finish-it"]crossposted[/URL]

Member Avatar for peter_budo
0
609
Member Avatar for pbracing33b

[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"); …

Member Avatar for mKorbel
0
2K
Member Avatar for hfx642

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) …

Member Avatar for hfx642
0
962
Member Avatar for LondonJava

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 …

Member Avatar for hfx642
0
480
Member Avatar for spades0001

agreed with Ezzaral for safiest way only to add flush method e.g. myIcon.getImage().flush(); then add Icon to JLabel myLabel.setIcon(myIcon);

Member Avatar for mKorbel
0
247
Member Avatar for poojavb

[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)

Member Avatar for poojavb
0
1K
Member Avatar for slasherpunk

@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 ....

Member Avatar for mKorbel
0
3K
Member Avatar for vaironl

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();

Member Avatar for mKorbel
0
2K
Member Avatar for lameraz

add Items to the [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/list.html"]DefaultListModel[/URL]

Member Avatar for lameraz
0
170
Member Avatar for nsyncpilu

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 …

Member Avatar for NormR1
0
1K
Member Avatar for nered

[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]

Member Avatar for nered
1
136
Member Avatar for BDan

your problem is setSize(FRAME_WIDTH, FRAME_HEIGHT);, then JFrames childs fills all empty space into Container,

Member Avatar for BDan
0
172
Member Avatar for dennysimon
Member Avatar for rayden150

[URL="http://stackoverflow.com/questions/8203628/how-to-add-a-jfreechartpie-chart-to-a-panel-in-netbeans"]crossposted[/URL]

Member Avatar for mKorbel
0
357
Member Avatar for upanotch

[URL="http://www.daniweb.com/software-development/java/threads/392789/1689145#post1689145"]JButton#setContentAreaFilled(false);[/URL]

Member Avatar for NormR1
0
178
Member Avatar for FALL3N

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]

Member Avatar for FALL3N
0
203
Member Avatar for rlhh

[URL="http://stackoverflow.com/questions/8107903/passing-input-from-jbutton-to-console"]crossposted[/URL]

Member Avatar for mKorbel
0
221
Member Avatar for jalpesh_007
Member Avatar for mKorbel
-1
209
Member Avatar for jhamill

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 …

Member Avatar for mKorbel
0
1K
Member Avatar for c.uetn

[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 …

Member Avatar for c.uetn
0
513
Member Avatar for coolsport04

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);

Member Avatar for coolsport04
0
928
Member Avatar for daneaum
Member Avatar for shady05

[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]

Member Avatar for JamesCherrill
0
3K
Member Avatar for dennysimon

you can use Focus, but for JTextComponent is there DocumentListener + Caret for JTextArea myTextArea.setCaretPosition(textArea.getDocument().getLength());

Member Avatar for dennysimon
0
189
Member Avatar for ali11
Member Avatar for Jessurider
Member Avatar for angeriel1

[URL="http://stackoverflow.com/questions/8043107/a-jlist-scoll-pane-program-that-reads-from-a-file"]crossposted[/URL]

Member Avatar for mKorbel
0
210
Member Avatar for akaicewolf
Member Avatar for skywire_

check this [URL="http://www.daniweb.com/software-development/java/threads/384072"]thread[/URL]

Member Avatar for mKorbel
0
2K
Member Avatar for Kayla1809
Member Avatar for hfx642

[URL="http://stackoverflow.com/search?q=user%3A714968+jslider"]maybe[/URL]

Member Avatar for mKorbel
0
124
Member Avatar for ricedragon

[URL="http://stackoverflow.com/questions/8018333/java-classes-interface-and-gui"]crossposted[/URL]

Member Avatar for JamesCherrill
0
639
Member Avatar for ali11

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 …

Member Avatar for JeffGrigg
0
2K
Member Avatar for ashsailesh

[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 …

Member Avatar for hfx642
0
183
Member Avatar for digan
Member Avatar for grako84

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)

Member Avatar for grako84
0
256
Member Avatar for canarian

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

Member Avatar for mKorbel
0
625

The End.