953 Posted Topics

Member Avatar for JohnSoftware

@stultuske you are wrong @JohnSoftware read official Oracle tutorial for working code example about how to search in JTextComponent with highlighting matches

Member Avatar for mKorbel
0
750
Member Avatar for anestistsoukalis

- JPanel uses FlowLayout as default LayoutManager inplemented in API - set GridLayout to JPanel (you already set to JFrame, then there you put JPanel with JComponents)

Member Avatar for mKorbel
0
188
Member Avatar for Benjamin_4

depend of how deep you want to go, you have to override RowFilter - basic red official Oracle tutorial [How to use Tables - Sorting and Filtering](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting) for working code example ___________________________________________________________ - [simple](http://stackoverflow.com/a/8187799/714968) - [extended](http://stackoverflow.com/questions/17854854/jtable-rowfilter-and-rowfilter-entry) - there is used JToggleButton for filtering, add Action/ItemListener to JComboBox then result will …

Member Avatar for mKorbel
0
1K
Member Avatar for Violet_82

- [EventHandler can do that](http://stackoverflow.com/a/9007348/714968), there you can to wrap a few events together, required excelent knowledge about Java Essential Classes, Swing and AWT Listeners, there/this (never tried) maybe doesn't works for Beans with PropertyChangeListener, PropertySupport, this info can be probably out of scope for you - every Listener (excluding …

Member Avatar for Violet_82
0
162
Member Avatar for Benjamin_4

[crossposted](http://stackoverflow.com/questions/20218165/how-to-update-jtable-based-on-the-items-i-click-in-my-jcombobox)

Member Avatar for mKorbel
0
208
Member Avatar for Benjamin_4

- use ListSelectionListener, test if selectedRow > -1 (no row is selected), otherwise you will received a few nice exceptions from endless loop, and this code construction to freeze current JVM instance, can be closed from Taskbar only - change JTables SelectionMode to SINGLE_...., otherwise you have to loop inside …

Member Avatar for mKorbel
0
283
Member Avatar for madhura_1

- never to perform long runnig task from ActionListener, nor wrapped into invokeLater, Swing GUi freeze untill long and hard JDBC ended - why did you recreated whole GUI on fixed period, Swing JComponents are designated to be reused, did you count those JFrames - no idea how to help …

Member Avatar for madhura_1
0
404
Member Avatar for london-G

- question in this form isn't answerable - Or can you suggest something else? 1. L&F must be intialized as 1st code line in main class 2. Swing GUI must be created on Initial Thread

Member Avatar for mKorbel
0
68
Member Avatar for Neon Tetras

and add - newIcon.flush() before is a new ImageIcon / Icon added to JLabel() - flush() can protect JLabels resouces to repaint correctly, especially in the cased that ImageIcon / Icon is loaded from local/network HDD or from URL (web etc...)

Member Avatar for stultuske
3
5K
Member Avatar for mufasil

- JFrame is Top-Level Container, its RootPane isn't by default focusable, then can't receive Key Events - you have to 1. put there JPanel 2. override paintComponent instead of paint 3. 1st. code line inside paintComponent(Graphics g){ shoudl be super.paintComponent, otherwise painting cumulated 4. use KeyBindings, in a state of …

Member Avatar for mKorbel
0
3K
Member Avatar for asif49
Member Avatar for asif49
0
126
Member Avatar for SHARATH_1

[crossposted](http://stackoverflow.com/questions/19839416/how-to-add-actions-on-the-image-in-jpanel)

Member Avatar for mKorbel
0
224
Member Avatar for Benjamin_4

1. create DefaultTableModel for JTable 2. in DefaultTableModel, there to override - public Class<?> getColumnClass(int column) { seems like as there are numbers only, then with Long or Double.Class - public boolean isCellEditable(int row, int col) { returns false (non-editable) for column contains sum, result - public void setValueAt(Object aValue, …

Member Avatar for mKorbel
0
208
Member Avatar for Denmbithi

- don't to create more that one JFrame, use JDialog with JFrame as parent, and/or with modality too - easiest of ways is usage of CardLayout with JPanels as Card, views - call JFrame.pack() after Card is switched (note works only in the case there is used LayoutManager, not NullLayout)

Member Avatar for Seldar
0
243
Member Avatar for Benjamin_4

- this question is about business rules, logics not about Java & JDBC, - by default most of profesional apps for trading has very similair structure and concept

Member Avatar for Benjamin_4
0
162
Member Avatar for Ann aiko
Member Avatar for mKorbel
0
116
Member Avatar for Ann aiko

- use JSpinner, read Oracle tutorial for working code example instead of String[] Month and String[] Day, otherwise you will able to add funny Date, e.g. 31. february etc... - for output to use JTextArea, formatted output from all JTextFields, JSpinners, JComboBoxes (with combine in text from JLabels)

Member Avatar for mKorbel
0
213
Member Avatar for srikanth2321

- right there is with Renderer in some cases not starting higlighter and its painting for begining of node, but starting where close parent ended - for future readers post ans [SSCCE](http://sscce.org/), short, runnable, compilable demonstrated a.m. defect from renderer, and with hadcoded value for Nodes

Member Avatar for srikanth2321
0
907
Member Avatar for minimee120

probalby 1) you want to use a) ActionListener for TextField only, then remove TextListener from TextField (standard logics for Chat) b) both, then content inside public void textValueChanged(TextEvent te) { must to know if is there event fired from ActionListener or KeyTyped, e.g. by using boolean for creating String or …

Member Avatar for JamesCherrill
0
273
Member Avatar for Hanyouslayer

note - this code is about old and refused practicies - never use Thread.sleep(int) in Java - never use Graphics g2 = panel2.getGraphics(); this method is proper for printing to printer or saving to BufferedImage - search here JPanel + paintComponent, delayed by Swing Timer

Member Avatar for JamesCherrill
0
346
Member Avatar for Benjamin_4
Member Avatar for vivosmith

[very similair suggestion to crosspost](http://www.coderanch.com/t/620697/GUI/java/Paint-painting)

Member Avatar for mKorbel
0
372
Member Avatar for Lamirp

use [JFormattedTextField](http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html)

Member Avatar for mKorbel
0
7K
Member Avatar for murali2489
Member Avatar for srikanth2321

extends **JEditorPane** implements **TreeCellRenderer** - please whats goal, reason('s maybe), simple why - whats has linked JEditorPane with TreeCellRenderer to do together as JTable Renderer - who from them is (may question could be) parent, who is child and grand_parent - my answer is simple, short **not**, don't do that, …

Member Avatar for mKorbel
0
872
Member Avatar for dalawh

[crossposted](http://stackoverflow.com/questions/18293574/adding-multiple-enums-to-jcombobox)

Member Avatar for JamesCherrill
0
811
Member Avatar for Peter_Aye

- override getPreferredSize not setXxxSize @Override public Dimension getPreferredSize() { return new Dimension(int, int); } - JPanel is ImageObserver, then null should be this **g.drawImage(image, getWidth(), getHeight(), this);** - its container (assume that JFrame) take it from JFrame.pack() - interesing is that you can to determine MinimumSize by JFrame.pack(); // …

Member Avatar for mKorbel
0
268
Member Avatar for sankubha

- Graphics graphics = cPanel.getGraphics(); 1. is proper methods for saving this snapshot to File, BufferedImage, paper Printer 2. this snapshot is very volatile, can expired on 1st mouse, key or from methods implemented in API 3. has nothing to do with ---> I need to draw an image Dynamically, …

Member Avatar for sankubha
0
241
Member Avatar for Petranilla

> Yes, this is experimental. Have not clean up yet. then before (and/or with suggestion by @JamesCherrill +++) - JFrame by default never to react to Key Event - add JPanel to JFrame - override paintComponent for JPanel instead of paint for JFrame - use KeyBindings instead of KeyListener or …

Member Avatar for Petranilla
0
720
Member Avatar for sankubha

- don't put JComponents to the XxxTableModel, there is stored only referrence, prepared value for Renderer/initial value for Editor - XxxCellRenderer isn't somehow restricted, but you have to accepting that everything here is only about static painting, virtual illusion based on methods implemented in APIs - there are three ways …

Member Avatar for mKorbel
0
990
Member Avatar for mikewyatt

- use JComboBox, a.m. logics doesn't require waiting for users decision - use JOptionPane in the case would need, stop to block code execution, - JOptionPane has internal event closed, canceled etc, more in the API - return Option_Seleted; probably returns number constant, e.g. button and closed, canceled

Member Avatar for mikewyatt
0
362
Member Avatar for guy40az

use JFreeCharts, there is termomether as pre_defined graph (in version that I tried), if not then is so easy to create Shapes with rainbows colors, toggle with value

Member Avatar for JamesCherrill
0
265
Member Avatar for Neon Tetras

> no its not. > its a personal project loop inside container where JComboBoxes are laid, by checking if(xxx instanceof JComboBox(Oracle APi)/ComboBox(your class)) desired and filtered Objects is accesible, pseudocode Component[] comp = container.getComponents(); for (int i = 0; i < comp.length; i++) { if (comp[i] instanceof Xxx) { comp[i].wheteverMethodImplementedInConcreteAPI; …

Member Avatar for mKorbel
0
1K
Member Avatar for mKorbel

please overview for Java Forum, http://www.daniweb.com/software-development/java/9 isn't accessible for me, I can't see any exception, screen is blank, missing there Q&A's

Member Avatar for JorgeM
0
306
Member Avatar for EkDs

- JFreeCharts are based on AWT, - calculation of final size (on the screen for all Swings LayoutManagers) is based on PreferredSize - childs returns PreferredSize back to contianer, then JFrame.pack(BorderLayout implemented in API) will calculate proper Rectangle for JFrame('s ContentPane) - good practicies is to override getPreferredSize for ChartPanel …

Member Avatar for JamesCherrill
0
258
Member Avatar for Shurui

- question isn't clear, please whats *I cannot find a way to display variables' values in Java Applet.*, variables from and for why reason(s), code posted is about basic Java knowledges and haven't something with Applet/JApplet, you'll be the same issue in C++/.Net or Php - use Hybrid JApplet (Swing …

Member Avatar for iamthwee
0
246
Member Avatar for srikanth2321

ActionListener is desingnated to runce only one time, from Mouse or Key Events, issue must be in rest of your code

Member Avatar for mKorbel
0
150
Member Avatar for srikanth2321

- myPanel.scrollRectToVisible(JComponentFrom_myPanel.getBounds()); - search for next focusable, you can to play with get/setFocusedComponent() wrapped into invokeLater - most complex code is based on myComponent.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS), after Focus switched is required to switch notifiers betweens JComponents too

Member Avatar for srikanth2321
0
172
Member Avatar for Deve

I miss there 1. override getColumnClass, its very important for JTables view to know data types stored in DefaultTableModel 2. reset DefaultTableModel to null, use (there are a few another methods, you can to starting with) **model.setRowCount(0);** before a new rows are added to 3. create (I assumed that there …

Member Avatar for Deve
1
2K
Member Avatar for london-G

do you meaning something similair as is for ATM, where you type (pseudo numbers) [7542 and result is 75.42, then is possible, quite easilly](http://stackoverflow.com/questions/17074758/make-a-jformattedtextfield-behave-like-atm-input)

Member Avatar for JamesCherrill
0
2K
Member Avatar for vinnitro

- get all Top-Level Containers from current JVM instance (I'm assume that there are only Swing containers) Window[] wins = Window.getWindows(); for (int i = 0; i < wins.length; i++) { if (wins[i] instanceof JDialog) { wins[i].whateverMethodsInAPIForJDialog; } else if (wins[i] instanceof JWindow) { wins[i].whateverMethodsInAPIForJWindow; } else if (wins[i] instanceof …

Member Avatar for vinnitro
0
283
Member Avatar for mikewyatt

1. is required to override [cancelCellEditing() and stopCellEditing()](http://docs.oracle.com/javase/7/docs/api/javax/swing/CellEditor.html#stopCellEditing%28%29) for TableCellEditor, you can to create startCellEditing() nested proper Boolean flag 2. otherwise, for better help sooner post an [SSCCE](http://sscce.org/), short, runnable, compilable, just about JFrame with JTable, invoked JOptionPane from TableCellEditor

Member Avatar for ageshyaw
0
2K
Member Avatar for vinnitro

- put there JPanel, don't to paint to the Top-Level Container directly - override for JPanel 1. getPreferredSize, then all coordinates for painting are based on getWeight/Height 2. use paintComponent() instead of paint() - don't to use Keylistener, use KeyBindings added to JPanel - don't to provide FileIO (ImageIcon), load, …

Member Avatar for JamesCherrill
0
2K
Member Avatar for JamesCherrill

- please do you mean, can we starting with (then I can't use escape characters, e.g. slash "\") - just code simulation, out of corrrect answer on my side . import java.util.*; public class MyStringArray { private List<String> strings; public MyStringArray(String[] strArr) { strings = new ArrayList<>(); strings.addAll(Arrays.asList(strArr)); } @Override …

Member Avatar for masijade
1
237
Member Avatar for somjit{}

- all Layout Managers(customs too), together with JFrame.pack() are calculated on PreferredSize (based on component tree, ZOrder), first is painted last, on top JComponent - with some LayoutManagers is possible to resize childs, with some isn't possible (FLowLayout), or settable (GridLayout, SpringLayout, MigLayout) - most of LayoutManagers accepts only PreferredSize, …

Member Avatar for somjit{}
0
356
Member Avatar for Wolfenstien

1. where you lost signpanel.add(signBtns[0]); 2. probably have to check all numbering for next JButtons 3. then array should be declared private JButton signBtns[] = new JButton[5]; 4. to dissable, comment code line //this.setContentPane(main_p);

Member Avatar for Wolfenstien
0
273
Member Avatar for CoilFyzx

- required to override (last two code lines) myTable.doLayout() myTable.repaint() - as dirty hack, sure better could be to move those methods to the XxxTableModel as method - all/both JTables view (in your case) have got only one ColumnModel

Member Avatar for JamesCherrill
0
478
Member Avatar for Petranilla
Member Avatar for Petranilla
0
164
Member Avatar for Petranilla

- add MouseListener to container (JPanel???) - override *public void mouseClicked(MouseEvent e) {* then there are two ways panel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getModifiers() == MouseEvent.BUTTON3_MASK && e.getClickCount() == 1) { // whatever } } }); or panel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) …

Member Avatar for Petranilla
0
10K
Member Avatar for vishalonne

[crossposted & answered](http://stackoverflow.com/questions/17137550/how-to-add-jradio-button-at-run-time)

Member Avatar for mKorbel
0
346

The End.