953 Posted Topics

Member Avatar for Samwal

1) line frame.setVisible(true); must be last line for JFrame constuctor 2) never use Graphics g = frame.getGraphics(); 3) use [URL="http://stackoverflow.com/a/7940227/714968"]KeyBindings[/URL] rather than KeyListener

Member Avatar for JamesCherrill
0
218
Member Avatar for sha11e

Robot must waiting for (half)second before first usage, this downvote isn't correct screen capture is same as SendKey by default [CODE]import javax.imageio.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.io.*; public class CaptureScreen implements ActionListener { private JFrame f = new JFrame("Screen Capture"); private JPanel pane = new …

Member Avatar for stultuske
0
3K
Member Avatar for long89

use [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html"]JFormattedTextField[/URL] with Number Formatter - doesn't care about parsing - set [URL="http://stackoverflow.com/a/8582656/714968"]Formatter to decision number format[/URL] - use [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/documentlistener.html"]DocumentListener[/URL]

Member Avatar for mKorbel
0
224
Member Avatar for chamnab

I think that nothing complicated in this case [URL="http://docs.oracle.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html"]public class DefaultTableModel extends AbstractTableModel implements Serializable[/URL] you have to add and override this method for removeRow in your AbstractTableModel [CODE]public void removeRowAt(int row) { data.removeElementAt(row); //fireTableDataChanged(); fireTableRowsDeleted(row - 1, data.size() - 1); }[/CODE]

Member Avatar for mKorbel
0
748
Member Avatar for shibu2all

1) place this code line [B]panel.setLayout(null); [/B] before placing JComponent 2) variables [B]JScrollPane scrollpane;[/B] and [B] JScrollPane scrollpane1;[/B] aren't initialized and rest of JComponents

Member Avatar for shibu2all
0
234
Member Avatar for rushikesh jadha

you can't put Image as background to [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html"]JFrame[/URL], but 1) ContentPane 2) paintComponent for JPanel / JComponent 3) [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/label.html"]JLabel[/URL] & [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html"]Icon[/URL] (notice JLabel haven't implemented any LayoutManager, you have to defin for that)

Member Avatar for rushikesh jadha
0
185
Member Avatar for lena1990

You have to set for [URL="http://docs.oracle.com/javase/6/docs/api/javax/swing/JTable.html#setAutoResizeMode%28int%29"]JTable#setAutoResizeMode[/URL], more is described in JTable's tutorial [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#width"]Setting and Changing Column Widths[/URL]

Member Avatar for mKorbel
0
76
Member Avatar for kalcio

not easy job with Nimbus, you have to define own Painter for [URL="http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/_nimbusDefaults.html"]Nimbus Defaults[/URL], much luck

Member Avatar for kalcio
0
2K
Member Avatar for Zaad

1) wrong that you used code generated by NetBeans 2) fireTableRowsInserted is job for AbstractTableModel, don't call tshi method directly 3) eeerrrgggggggggggt, use DefaultTableModel [CODE]import java.awt.*; import java.awt.event.*; import java.util.Random; import javax.swing.*; import javax.swing.border.LineBorder; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; public class DefaultTableModelDemo { public static final String[] COLUMN_NAMES = { "Monday", …

Member Avatar for Zaad
0
1K
Member Avatar for vaironl

@cOrRuPtG3n3t!x what's an aswers is [CODE]maybe you coud try setting the bounds of components by setBounds() and setMaximumSize(Dimension) and even setPreferredSize(Dimension) methods? [/CODE] no never setBounds, this is job for LayoutManager, occasionally you can place that by take Insets, but why not use MigLayout most of LayoutManagers pretty ignored setXxxSize

Member Avatar for vaironl
0
110
Member Avatar for javaprog200

if you set [B]JTextArea(m, 10, 15);[/B] , then [B]scroll.setSize(500, 500);[/B] is too contraproductive, call for [B]scroll.pack();[/B] before [B]scroll.setVisible(true);[/B] rather than manually set for size on the screen

Member Avatar for javaprog200
0
183
Member Avatar for venomlash

@117 please and a new quesion, your own question, before that please to read 1. [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html"]Mouse Listener[/URL] 2. [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/mousemotionlistener.html"]Mouse-Motion Listener[/URL] 3. [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/mousewheellistener.html"]Mouse-Wheel Listener[/URL] 4. let's this too old thread

Member Avatar for 117
0
7K
Member Avatar for ForceStr

you have to add [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/documentlistener.html"]DocumentListener[/URL] for listening any of changes in [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/text.html"]JTextComponents[/URL] this code for ??? AutoComplete ??? JTextField have got two big issues 1) most important rs (ResultSet) and stmt (Statement) must be closed into finally block, otherwise these Object stay in RAM until current application ended 2) your …

Member Avatar for ForceStr
0
180
Member Avatar for mehnihma

[URL="http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html"]JMenu[/URL] isn't designated to invoke any action, JMenu is container nested [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html#event"]JMenuItem(s)[/URL], sure there are two/three choices how to determine if JMenu is visible / hidden my question Why do you want/need to listening for that, for why reason

Member Avatar for DavidKroukamp
0
1K
Member Avatar for Gsterminator

1) for new window use [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html"]JDialog / JWindow[/URL] rather than a [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html"]JFram[/URL]e 2) for key shortcut use [URL="http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html"]KeyBindinds[/URL] rether than [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html"]KeyListener[/URL]

Member Avatar for mKorbel
0
140
Member Avatar for Yarra

Swing (from Java5) for [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html"]Top-Level Containers[/URL] implemented BorderLayout as default [URL="http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html"]LayoutManager[/URL]

Member Avatar for mKorbel
0
177
Member Avatar for freakybeavis

better once time to see that as 100 times .... [CODE]import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; // based on @trashgod code /** @see http://stackoverflow.com/questions/5759131 */ // http://stackoverflow.com/questions/8667719/jdialog-repaint-after-jlist-modification public class ListDialog { private static final int N = 12; private JDialog dlg = new JDialog(); private DefaultListModel model = new DefaultListModel(); …

Member Avatar for freakybeavis
0
237
Member Avatar for Skeldave

@JamesCherrill invalidate(), please not, never can you please describe reason for sending flag Invalidate for JComponent, I thin that you'll never call this method by hand, because by default is implemented correctly in APIs, and if yes then you have to confirm that by notify()/notifyAll() for already visible Container is …

Member Avatar for JamesCherrill
0
285
Member Avatar for SasseMan

1) I have a JScrollPane that contains a JPanel with a CardLayout, good GUI design for various screens ratio in pixels and ready for crossplatfom +1 for question 2) I want the contents of the ScrollPane/ViewPort to never exceed the width of the viewport. basically that's contraproductive in contex that …

Member Avatar for mKorbel
1
182
Member Avatar for xzero1

it too hard to implementing JList & Render with some of dirty hack, use JTable with one Column, 1) JTable with JCheckBox is represented with Boolean value only 2) no required any code for Renderer/Editor, because JTable knows Boolean value 3) JTable must be editable for Editor 4) everything [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html"]here[/URL]

Member Avatar for xzero1
0
543
Member Avatar for vishalonne

even oracle tutorial talking about ActionListener, better would be look for [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/itemlistener.html"]ItemListener[/URL]

Member Avatar for mKorbel
0
217
Member Avatar for Majestics

what's Filter for why reason is Filter what's KeyWord where do you want to put Filter that can filtering some (of) KeyWord(s) too hard to start to wrote anything else without yours ...

Member Avatar for Majestics
0
82
Member Avatar for scheppy

@JamesCherrill @Ezzaral until yesterday I ignored [URL="http://docs.oracle.com/javase/6/docs/api/java/beans/EventHandler.html"]EventHandler[/URL], but now ... somehow as I tried from 'left _to_right_and_back'... I can't found something wrong, nor buggy, here is an [URL="http://stackoverflow.com/a/8942519/714968"]answer[/URL], link inside the code example is about JButton

Member Avatar for scheppy
0
372
Member Avatar for janfritz

[URL="http://stackoverflow.com/questions/8955663/paintcomponent-output-error"]crossposted[/URL]

Member Avatar for hiddepolen
0
232
Member Avatar for friknos

@cOrRuPtG3n3t!x please use links to the current Java6/Java7 API's, because in most of them were important changes in nested on inherits methods however +1 for simple and clear suggestion

Member Avatar for friknos
0
138
Member Avatar for seredi

there are lots of good workaround for JTable and Database, I'd suggest to search for ResultsetTableModel or TableFromDatabase

Member Avatar for itexamstube
0
782
Member Avatar for person192

@Philippe.Lahaie because upvoting is about - valuable info - excelent suggestion - agreement with corret answer - nice answer - etc possitive otherwise on another side is down_vote, but I can't answering this instigation of down_voting, simple I can't found any answer for down_voting or all were deleted before I …

Member Avatar for peter_budo
0
218
Member Avatar for Majestics

[URL="http://stackoverflow.com/a/7553827/714968"]Double haven't any numbers, nor decimal [/URL] (authors lots of Books about Networking, basic Java and Algebra), for real number is Double best way how to represent Number value with correct precisions

Member Avatar for mKorbel
0
313
Member Avatar for scheppy
Member Avatar for scheppy
0
145
Member Avatar for syeda amna

1) JWindow is un_decorated Container, there aren't any button (JFrame has three, JDialog only one), 2) this window isn't possible close, hide or terminate current JVM without additional Action e.g from JButton, JMenu or another code that call System.exit(i int), best way is use this container as popup window for …

Member Avatar for mKorbel
0
2K
Member Avatar for sharathg.satya

@stultuske I think that no, never ..., Swing GUI isn't designated for listening of KeyListener, especially JTextComponents, because required some Woodoo for correct Focus / FocusSubsystem and required override method setFocusable() [URL="http://stackoverflow.com/questions/7940173/how-do-i-use-keyeventdispatcher/7940227#7940227"]use KeyBindings[/URL], 1) no required override Focus behavior 2) can possible replace/overrive built-in key_shortcuts from BasicXxxUI 3) with same/similair …

Member Avatar for stultuske
0
187
Member Avatar for mohamed moamen
Member Avatar for sirlink99

most of yours KeyEvent are implemented as internal commands for various JComponents, you can check that in BasicXxxUI, how many times I suggest you implements another API

Member Avatar for sirlink99
0
143
Member Avatar for vaironl

not this is by forcing frame.setSize(900,700);, that real reason why ... use pack instead however you can setSize() but 1) don9t use reserved words as ClassName, rename Frame ---> MyFrame panel ---> MyPanel 2) class name start with UpperCase 3) void or method with lowerCase 4) if you want ot …

Member Avatar for mKorbel
1
1K
Member Avatar for mohamed moamen

you have look for method paintComponent, check tutorial [URL="http://docs.oracle.com/javase/tutorial/2d/index.html"]Graphics[/URL]

Member Avatar for mohamed moamen
0
1K
Member Avatar for Majestics

1) JMenu.addSeparator this JSeparator has Color, you can change this Color for translucent effect 2) JMenuItem.setBorder(new EmptyBorder(10,10,10,10));

Member Avatar for Majestics
1
113
Member Avatar for Libanesaren

not going to test or run bunch of your code posted here 1) your AbstractTableModel not correct, there is useless TableModel or whole class Kund, because both are Models, and you can fill data for JTable from class Kund correctly, and returns changes from JTable to the class Kund correctly …

Member Avatar for mKorbel
0
209
Member Avatar for kinesaren

you have look for [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting"]JTable Sorting / Filtering[/URL], tutorial contains similair example

Member Avatar for kinesaren
0
247
Member Avatar for sirlink99

why bothering with that not simple job use JDialog instead, don't have a minimize maximize button.

Member Avatar for dmanw100
0
96
Member Avatar for 03hasnam

SwingX have got implemented excelent Java Calendar, there is simple workaround for Weekend and same way you can implements Special Days, agreed with @NormR1 must be manually hardcoded/added to the File or Database

Member Avatar for dmanw100
0
2K
Member Avatar for Majestics

there any Bug with TableCellEditor, some your mistake, post a runnable code that demonstrated your issue, because your code works in my hands as I expected

Member Avatar for Majestics
0
230
Member Avatar for buchanan23

not runs your code 1) textArea1.append(String.valueOf(df.format(monthlyPayment)) + "\n"); 2) use [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html"]JFormattedTextField[/URL] similair example in the tutorial 3) Add scroll bars to textArea read tutorial about [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html"]JTextArea[/URL]

Member Avatar for buchanan23
0
4K
Member Avatar for sirlink99

1) one most confortable way is put formatted output from the File to the JTable with removed H & V grid 2) by using Html is possible tabular output to the JTextPane, JTextArea not designated use Htlm correctly 3) create three JTextArea (added to JPanel) EDIT 4) [URL="http://stackoverflow.com/questions/8533612/align-strings-in-columns-in-jtextarea"]here[/URL] is your …

Member Avatar for mKorbel
0
233
Member Avatar for kiswah03

1) you have to accept that [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html"]JScrollpane[/URL] is designed to nest only one [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html"]JComponent[/URL], 2) there simply workaround put three [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html"]JTables[/URL] to the [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/panel.html"]JPanel[/URL], 3) JScrollpane.add() function is not right check [URL="http://docs.oracle.com/javase/6/docs/api/javax/swing/JScrollPane.html#JScrollPane%28java.awt.Component%29"]contructor in API[/URL]

Member Avatar for mKorbel
0
100
Member Avatar for skiabox

all changes for Swing JComponents must be done in EventDispashTread, and you have issue with Concurency in Swing, because your method IncomingReader doesn't inkoke EDT, short description ---> wrap incoming.append(message + "\n"); to the invokeLater() long [URL="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html"]Concurency in Swing[/URL]

Member Avatar for skiabox
0
354
Member Avatar for scheppy

1) look how [URL="http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html"]LayoutManager[/URL] works 2) use [URL="http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html"]CardLayout[/URL] instead of AbsoluteLayout 3) read tutorial about [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html"]ActionListener[/URL], [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/button.html#abstractbutton"]JButton[/URL] and [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html"]JMenu[/URL], 4) if you don't want to bothering with CardLayout, then for swaping (remove then add) betweens JComponents you have to call revalidate(); repaint();//most cases required 5) follows examples from linked tutorials

Member Avatar for scheppy
0
167
Member Avatar for akingcool

better would be look at [URL="http://docs.oracle.com/javase/6/docs/api/javax/swing/text/JTextComponent.html#write%28java.io.Writer%29"]JTextArea#write(Writer out) throws IOException[/URL] then put JTextArea to JOptionPane

Member Avatar for mKorbel
0
3K
Member Avatar for nsyncpilu

1) that not possible, you have to add one JLabel on the TOP and 2nd on BOTTOM, 2) not possible change [URL="http://stackoverflow.com/questions/6144775/messageformat-header-footerformat-how-to-change-font-for-jtable-printing"]Font and another methods[/URL], [CODE]MessageFormat header = new MessageFormat(" Whatever"); MessageFormat footer = new MessageFormat(" Page {0,number,integer} Whatever"); try { PrintRequestAttributeSet set = new HashPrintRequestAttributeSet(); set.add(OrientationRequested.LANDSCAPE); myTable.print(JTable.PrintMode.FIT_WIDTH, header, footer, …

Member Avatar for mKorbel
0
1K
Member Avatar for mKorbel
Member Avatar for Armanious

[URL="http://docs.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html#isLeftMouseButton%28java.awt.event.MouseEvent%29"]SwingUtilities[/URL] implements (only for mouse with three Buttons, for example there are Mouse with 5Buttons, then rest of Buttons are ignored by default) isLeftMouseButton isMiddleMouseButton isRightMouseButton

Member Avatar for JamesCherrill
0
238

The End.