953 Posted Topics

Member Avatar for psy.blast

- don't to create a new [Top-Level Container](http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html), nor on runtime, this is road to the troubles - see [CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) - there are issues with variables (I can see that in **ActionPerformed**) - why to re_create a new **JComboBox typeCargo = (JComboBox)evt.getSource();**, this **JComboBox** isn't placed and layed in **Swing …

Member Avatar for JamesCherrill
0
244
Member Avatar for W1nst0n

@JamesCherrill is not used, but to avoiding of catching the image, I'm not good in Graphics, but I saw a few suggestion to use byte[] and ImageObserver, but for JPanels Background, there is paintComponent best of ways (with boolean for repaint())

Member Avatar for mKorbel
0
394
Member Avatar for poojavb

not never to use **KeyListener** for **JTextComponents**, wrong way, have look at **DocumentFilter** for special **Chars** to use **Pattern**

Member Avatar for JamesCherrill
0
3K
Member Avatar for abhishek20
Member Avatar for vishu.bhavsar

>Can I reduce the size of the JTable? Currently it takes the size as that of the panel. no idea about numbers of records. but 1) **myJTable.setPreferredScrollableViewportSize(myJTable.getPreferredSize())**, for a few row, this should to reduce the size of **JScrollPane** 2) have to get **height from row** (Assume that every rows …

Member Avatar for mKorbel
0
1K
Member Avatar for Commando123

- for better help sooner post very short, compilable and runnable [SSCCE](http://sscce.org/), demonstraded your real issue, - otherwise everything are shots to the dark, - whats **laf_11112.jar** - read [Modifying the Look and Feel](http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/index.html) before

Member Avatar for mKorbel
0
191
Member Avatar for mikewyatt

1.) File f = new File("C:\\Photos\\System\\Wooden Floor 4x4.png"); don't load anything, nor **FileIO** inside **paint** / **paintComponent** / **paintChildren**, prepare this Object as local variable, because a) paintComponent is called internally when JComponent required repaint() b) each of mouse and keyboard events to invoked paintComponent 2.) int height = image.getHeight(); …

Member Avatar for mKorbel
0
86
Member Avatar for Darshan5

1. don't use **KeyListener** for **JTextComponents**, use **DocumentListener**, 2. use **JFormattedTextField**, 3. I'd be to use **DocumentFilter** with **Pattern**, filtering for non_alphabets chars, then there no needed any prompt about non_number char is inputed,

Member Avatar for JamesCherrill
0
189
Member Avatar for ownedbynothing
Member Avatar for mKorbel
0
599
Member Avatar for adarshcu

java.Util.Date myDate = rs.getDate("DateOfTask"); for various column def on DbSide Datetime, date, time, TImestmpt

Member Avatar for rahul.pedduri
0
2K
Member Avatar for jalpesh_007

Container panel = myTextField.getParent(); SwingUtilities.invokeLater(new Runnable() { public void run() { panel.scrollRectToVisible(myTextField.getBounds()); } }); - or another way by determine **Rectangle** from some **Point** of **JPanel** and by moving with the **JViewport** (not easiest of ways, but you can to e.i. centering **Point** rellative to the **JViewport**)

Member Avatar for jalpesh_007
0
196
Member Avatar for sk8ergirl
Member Avatar for abders

- why bothering with compilier, better could be to post to forum, isn't it ....... - there isnt created any of two JFrames, - there are two main methods remove one of them - don't extend JFrame, create that as local variable, otherwise part of important methods isn't accesible directly, …

Member Avatar for abders
1
291
Member Avatar for mohamed moamen

- there no reason to add **MouseListener** or **MouseMotionListener** to [JTable](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#selection) (but to use for ToolTip), add [ListSelectionListener](http://docs.oracle.com/javase/tutorial/uiswing/events/listselectionlistener.html), code examples in both of links from Oracle tutorial - notice [Filtering and Sorting](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting) can complicating those things

Member Avatar for mKorbel
1
150
Member Avatar for sharathg.satya

setSize for JFrame must be calculated by Layout Manager, then each of JComponetns returns JComponetns.getPreferredSize(...), JFrame raised getScreenSize by call pack(), in another cases windows freeze, flickering during any action(s) with Container, action as resize, add/remove/replace/swich JCompoents....

Member Avatar for NormR1
0
2K
Member Avatar for sathya88

dispose(), really nothing for JFrame (JDialog, JOptionPane or JWindow)'s lifecycle, that's same as setVisible(false) for JFrame is there System.exit(0); or JFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); these two methods always close all Object, kill the current JVM Instance, that valid only for JFrame, because has implemented method finalize(), another Top-Level Containers (JDialog, JOptionPane, JWindow) miss …

Member Avatar for hoon85
0
3K
Member Avatar for bharath54321

@ Taywin, again JTable :-), <withOutFW> updateUI() == that's nothing to do with JTable, please don't updateUI, don't do that, never, forgot that that exist something as updateUI, right now, its road to the hell (on 1st.exceptions you ends with NPE or RepaintManager)<withOutFW> :-) near to repaint reality - SwingUtilities.updateComponentTreeUI(topLayOutContainer); …

Member Avatar for stultuske
0
147
Member Avatar for ubi_ct83

probably better would be start with Vector (in future is possible to directly sets as dataSource for JTable) each line is [CODE] Vector<Object> myVector = new Vector<Object>(); [/CODE] where wildCard Object speak about variable contents for every of Elements, if Elementscontains same Data Type and structure for example you'd store …

Member Avatar for JamesCherrill
0
665
Member Avatar for kunaldinde

> When i type a charactor in jtextfield popup list is show popup but when i press the down arrow its cant select index of popup lists use JComboBox

Member Avatar for mKorbel
0
55
Member Avatar for enakta13

KeyListener isn't designated for listening KeyEvents came from keyboard, for GUI based on Swing JComponents use KeyBinding instead

Member Avatar for mKorbel
0
823
Member Avatar for makehaste

why not, this is simple and possible, you can put there GlassPane, could be layed and possitioning by every Layoutmanagers, notice GlassPane can consume only MouseEvents,

Member Avatar for mKorbel
0
147
Member Avatar for Thermalnuke
Member Avatar for prnjn

don't use two or more JFrames, use CardLayout instead, if you need popup window for input of value use JOptionPane

Member Avatar for mehfooz
0
246
Member Avatar for Majestics

not full text of the message could be useless (maybe) pot here a SSCCE, because in most cases talking about to filling the the data to JTable without definitions about ouw model, no way heavens can you somone to expain me why this a new version of this forum is …

Member Avatar for Majestics
0
283
Member Avatar for Onlineshade

no JTable there aren't any limitation, issue about limitiations must be hidden somewhere in your code http://docs.oracle.com/javase/tutorial/uiswing/components/table.html

Member Avatar for Onlineshade
0
218
Member Avatar for FALL3N

you can use JToolbar, this container is dockable and movable out/in from/to the Container (e.g. JFrame)

Member Avatar for FALL3N
0
138
Member Avatar for devninja
Member Avatar for devninja
0
454
Member Avatar for mehnihma

you have to search and use hightlighter from [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html"]Document[/URL], linked tutorial contains searching and Hightlighter too

Member Avatar for peter_budo
0
5K
Member Avatar for djescobar

@TIM_M_91 great suggestion +1, but remove code line (from your answer) pic1.setBounds(0,0,903,763); then you'll k*i*l*l used GridLayout

Member Avatar for djescobar
0
233
Member Avatar for kalcio

please read how the [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html"]JTabl[/URL]e works, there is detailed describtions about how to populating data for JTable

Member Avatar for mKorbel
0
163
Member Avatar for 117

1) learn for [URL="http://www.javapractices.com/topic/TopicAction.do?Id=58"]Naming Conventions[/URL] 2) don't use [URL="http://docs.oracle.com/javase/tutorial/uiswing/layout/none.html"]AbsoluteLayout[/URL] for dynaminc container, I saw a few simialir code, but you have to add [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/componentlistener.html"]ComponentListener[/URL] delayed by [URL="http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html"]Swing Timer[/URL] , that reduce caused flickering

Member Avatar for 117
0
4K
Member Avatar for mangopearapples

I hoping that you created folder with name Images there are lots of ways: [CODE] button.setIcon(new ImageIcon(this.getClass().getClassLoader().getResource("Images/iconName")));[/CODE] but I still prefered [CODE] Image ViewFxImage = ImageViewFxLoader.getImage(ViewFxDeals.class, "resources/passed.png"); final Icon ViewFxIcon = new ImageIcon(ViewFxImage); myButton.setIcon(null); //remove Icon myButton.setIcon(ViewFxIcon); //add Icon class ImageViewFxLoader { private ImageViewFxLoader() { } public static Image getImage(Class<?> …

Member Avatar for Moraes V.A.
0
358
Member Avatar for shubham123
Member Avatar for mKorbel
0
142
Member Avatar for jouj

well my question where is file with name [B]lebanon ball.jpg[/B] placed, because I miss there - rellative path to the resources in the Java package, - absolute path to the HDD, - URL from to the Http

Member Avatar for NormR1
1
170
Member Avatar for RDane

[URL="http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#editrender"]JTable[/URL] knows Date instance, in the linked tutorial is list of types of data, for these types of data aren't required set whatever or modifying ...

Member Avatar for ztini
0
2K
Member Avatar for shean1488

1) basic stuff (valid for part of programing languages) is use nested layout - put 4 JButtons to the JPanel layed by GridLayout, - put this JPanel put to the JFrame myFrame.add(myFirstPanel, BorderLayout.CENTER) - put JLabel to the another JPanel (without declaring for LayourManager is there FlowLayout and JLabel will …

Member Avatar for shean1488
1
125
Member Avatar for tabish saroha

I hope that Objects [B]connect[/B] and [B]disconnect[/B] are some of [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/index.html"]JComponents[/URL] with added [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/index.html"]ActionListener[/URL]

Member Avatar for NormR1
0
132
Member Avatar for Steve2490

maybe [CODE]import javax.swing.*; import java.net.URL; class ShowAnimatedGif { public static void main(String[] args) throws Exception { final URL url = new URL("http://pscode.org/media/starzoom-thumb.gif"); SwingUtilities.invokeLater(new Runnable() { public void run() { //JLabel l = new JLabel(new ImageIcon(url)); //JOptionPane.showMessageDialog(null, l); JButton btn = new JButton(new ImageIcon(url)); JOptionPane.showMessageDialog(null, btn); } }); } }[/CODE]

Member Avatar for mKorbel
0
815
Member Avatar for LFCFan_07
Member Avatar for mKorbel
0
2K
Member Avatar for htp367

I don't see there any lack, no reason for KeyBindings nor for out_dated KeyListener [CODE]import java.awt.*; import java.awt.event.*; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import javax.swing.*; //http://stackoverflow.com/questions/7769885/interrupted-exception-when-closing-file-open-dialogue public class GUI extends JPanel implements ActionListener { static private final String newline = System.getProperty("line.separator"); private static final long serialVersionUID = 1L; private …

Member Avatar for htp367
0
720
Member Avatar for yuyumerry

I think that nothing complicated (@zeroliken answered that by default), just follows turorial about [URL="http://docs.oracle.com/javase/tutorial/2d/images/index.html"]Graphics2D in Swing[/URL] and [URL="http://java.sun.com/products/java-media/2D/samples/suite/"]Java 2D API Sample Programs[/URL]

Member Avatar for yuyumerry
0
369
Member Avatar for tleverington1

use [URL="http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html"]CardLayout[/URL] for switch betweens views

Member Avatar for tleverington1
0
2K
Member Avatar for Shynika
Member Avatar for mKorbel
0
57
Member Avatar for TrickyT

[URL="http://docs.oracle.com/javase/tutorial/uiswing/components/text.html"]official Swing tutorial[/URL] [URL="http://www.java2s.com/Code/Java/Swing-JFC/CatalogSwing-JFC.htm"]tons of Examples[/URL]

Member Avatar for stultuske
0
158
Member Avatar for ForceStr

[U]Could anyone post some working example??[/U] why not, tutorials lined by @StephNicolaou contains a few examples,

Member Avatar for ForceStr
0
148
Member Avatar for sahmeme

1) don't create JComboBox inside Databases Connection, create this JComponent before connection, 2) put this data to the Vector, inside ResultSet loops only add myVector.add(rs.getString(2)), 3) test if isn't rs.getString(2) null or empty, because emty JComboBoxes Item doesn't looks like nice....

Member Avatar for mKorbel
0
159
Member Avatar for rockstar03

use [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html"]JFormattedTextField[/URL] with Number formatter, and add [URL="http://docs.oracle.com/javase/tutorial/uiswing/events/documentlistener.html"]DocumentListener[/URL]

Member Avatar for rockstar03
0
191
Member Avatar for tleverington1

you are going correct directions, you can listening for ENTER key from JTextField, I think that you have look at [URL="http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html"]JFileChooser[/URL]

Member Avatar for tleverington1
0
194
Member Avatar for sj5536

good conception required, followed steps [CODE] . . . content.setPreferredSize(new Dimmension(800,600)) . . content.add(someComponents) . . //last lines would be JFrame mainWin = new JFrame("Main Window"); mainWin.add(content, BorderLayout.CENTER); mainWin.pack(); mainWin.setVisible(true); [/CODE]

Member Avatar for Punit.Shah
0
5K
Member Avatar for dcalladi

you have to set NumberFormat for JFormattedTextField, maybe use JSpinner with SpinnerNumberModel [CODE]import java.awt.*; import java.awt.font.TextAttribute; import java.math.*; import java.text.*; import java.util.Map; import javax.swing.*; import javax.swing.JFormattedTextField.*; import javax.swing.event.*; import javax.swing.text.InternationalFormatter; public class DocumentListenerAdapter { public static void main(String args[]) { JFrame frame = new JFrame("AbstractTextField Test"); final JFormattedTextField textField1 = …

Member Avatar for mKorbel
0
352

The End.