Click here to Skip to main content
15,868,016 members
Everything / Desktop Programming / Swing

Swing

Swing

Great Reads

by Shubhashish_Mandal
Animated sliding panel in Swing.
by Santhosh Kumar Jayaraman
How to create a simple IMEI validator application using Java Swing
by csanuragjain
Captures, searches, and manages all your screenshots in one place.
by Osmund Francis
Creating templates in Eclipse to generate Java EventQueue statements

Latest Articles

by Michael B Pliam
A recursive descent math expression parser with built-in functions and a variable mapping
by Tung.Nguyen.2k
How to implement B-Tree's searching, insertion and deletion in Java
by AmosShi
Watch the Java class file visually & interactively for the meaning of every byte
by Ngo Tuong Dan
A usecase for Java beginner

All Articles

Sort by Score

Swing 

21 Mar 2013 by Shubhashish_Mandal
Animated sliding panel in Swing.
5 Jul 2012 by Santhosh Kumar Jayaraman
How to create a simple IMEI validator application using Java Swing
5 Feb 2013 by V.
Just my two cents, but I see it more in OS related terms. Windows or Linux. If you're more a Linux or MacOS kind of guy, go to C++ and java else .Net is the way to go. It is also rarely a combination. Although it is a good idea to have knowledge of several technologies, often you use...
7 Jun 2013 by csanuragjain
Captures, searches, and manages all your screenshots in one place.
24 Jul 2014 by Osmund Francis
Creating templates in Eclipse to generate Java EventQueue statements
20 Nov 2010 by Richard MacCutchan
The strings returned by getText() contain trailing spaces which parseInt() objects to. Change your code to something like:String stemp = t1.getText().trim();int a=Integer.parseInt(stemp);
2 Dec 2011 by Software_Developer
[AWT, SWT, Swing: Java GUI Pros & Cons][SWT, Swing or AWT: Which is right for you?][Swing and SWT: A Tale of Two Java GUI Libraries][SWT vs. Swing & Eclipse vs. NetBeans 5.0][Swing vs AWT vs SWT ]
22 Nov 2012 by TorstenH.
You do not have the right to save in other locations.Default Policy Implementation and Policy File Syntax[^]Read it.
5 Feb 2013 by Joezer BH
The answer is: depends on who you are asking!Most people (including me) here in CP will probably say with .NET but the fact is that it's just an opinion, and some of my best friends (who are wrong about this question) will tell you with Java (being that it's cross OS). There you have...
8 May 2013 by Filipe Marques
Hi Kapilk,Just use an array. You read the number of of columns from the combobox and then create an array of JCheckBox:int numberCheckBox = ...JCheckBox[] checkBoxList = new JCheckBox[numberCheckBox];for(int i = 0; i
10 May 2013 by nameJulian
Use this code, I have written it myself and it works:import java.awt.BorderLayout;import java.util.ArrayList;import javax.swing.BoxLayout;import javax.swing.JCheckBox;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JPanel;import...
10 Jul 2013 by TorstenH.
Working with non-ASCII Fonts can be a real pain.Stick to UTF-8, that will make it better for you. UTF-8 is kind of a ASCII-konform encoding for non-ASCII characters.You can use the class Font[^] for that.Please also check out some of the following:- internationalization-...
13 Jan 2016 by Richard MacCutchan
The message:Exception in thread "main" java.lang.UnsatisfiedLinkError: no win32com.dll in java.library.pathis quite clear. The loader cannot find the dll anywhere.
29 May 2016 by Richard MacCutchan
It looks like you are using some form of data binding to display the details, which will result in the table you see. To create the alternate version you will need to do one of two things:1. Read all data manually and insert each item into the row and column you want.2. Convert each row from...
5 Mar 2020 by OriginalGriff
Events don't happen immediately: they go into a "queue" and are answered in order (except paint - it's a low priority event, so anything more important will be moved up the queue past it). And the messages queue is only examined once processing...
2 Dec 2009 by AspDotNetDev
Well, the URL has a semicolon where it should have a colon. That could be a problem.http;//Should be.http://Also, the web services I work with typically have an extension in the URL, but that could just be because I work with Microsoft technologies. For example:NWSSService?wsdlWould...
22 Jul 2010 by Dalek Dave
Not if you want to take on the challenge :)
26 Apr 2011 by santosh dhanawade
Your class should implement keyListener adapter to do so,public class KeyListenerTester extends Frame implements KeyListenerThen implement,public void keyReleased(KeyEvent Event) { int key=evt.getKeyCode(); ///using validation here /// ascii code A=65...
24 May 2012 by codeBegin
check some links:http://stackoverflow.com/questions/7175990/java-chatserver-with-gui[^]http://www.roseindia.net/chatserver/[^]http://ruchirac.blogspot.in/2009/09/create-chat-server-in-java-rpc.html[^]http://www.indiastudychannel.com/projects/1233-Chat-application-JAVA.aspx[^]
24 May 2012 by Prasad_Kulkarni
Please have a look on following threads:A Simple chat program with client/server[^]Java Chat Application[^]Creating messanger in Java[^]Java/socket programming : chat program[^]
29 Aug 2012 by stib_markc
Hi,I am creating a GraphGUI. I have attached 2 panels a GraphPanel(for graph sheet) and a COntrolPanel(for button controls). I placed two buttons a 'sine' and 'cosine' which should display it's corresponding wave on GraphPanel upon clicking them. Right now I am doing event handling for my GUI...
29 Aug 2012 by Nagy Vilmos
The comparison in the if statement is wrong, you want to know if the item in the listener array can be cast to a GraphListener. This works:if (GraphListener.class.isAssignableFrom(listeners[i].getClass())) {
31 Aug 2012 by stib_markc
I have built a GUI on which I want to show sine and cosine graphs.The code for drawing the graph is :while(x1
30 Aug 2012 by stib_markc
Just adding phases solved my problem, it has been a long time since I used trigonometry or the"ALL SILVER TEA CUPS" idiom. For sine wave I have added a phase of PI/2 and for cosine wave I have added a phase of (1.5)*PI.
9 Sep 2012 by Member 8897891
Hi Sir/Mam i am new in java environment. i have to develop a project based on java swing. i have made a single form using JFrame.but as per the requirement in main frame window there is some tab on opening there should be open new frame window.i have not gotten the idea how to open...
9 Sep 2012 by TorstenH.
You need an architecture.You application does not need to have a visible JFrame - therefor your application can also have multiple JFrames.Your Main-class - starting point for the application - needs to trigger a basic application without GUI.That basic application defines the...
4 Oct 2012 by Member 8897891
According to my requirement i have to plot a .DAT file data in the form of a power and power2,4 and 8 display graph using java swing. if some one have any idea about it please help me.thanks in advance.
8 Feb 2013 by Fredrik Bornander
That is because in BufferedImages with a ColorModel the pixel is set to the nearest colour chosen. That means that you might not get the colour you wanted because the colours you can set are limited to the colours in the ColorModel.You can get around that by creating your own BufferedImage...
8 May 2013 by Kapilkp
how can i create jcheckboxes dynamically;i am getting table name in a comboBox and i want to add as many checkboxes as the number of columns the selected table have.pls help me out;
17 Jun 2013 by OriginalGriff
Without knowing what you are trying to do, and what the errors you can see are, we can't help that much!But...there are a few bits that spring out as being a bit weak:Do Console.WriteLine("Please choose the program you would like to select") MenuOption = Console.ReadLine If...
27 Jun 2013 by TorstenH.
- Do NOT work in main- Do NOT use keywords like "Frame" for variables.- Do NOT start variable names with upper case - uppercase is an objects name, never a variable.Please bookmark this link: http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html[^]public class MyForm...
12 Sep 2013 by Shubhashish_Mandal
Add Save functionality in ReportCat, a Java print library.
6 Dec 2013 by rajahari kannan
Hi guys,Nested GridView [No JavaScripts][^]I am a newbie to java and swings. I wanted to develop the same in the link provided above with java jtables. I am not able to figure it out and if possible can any help me out giving a sample code.i tried only populating a table and with the...
6 Dec 2013 by TorstenH.
That is possible by add a Panel / some component as cell content containing another Table.I have also often seen a Jpanel with a GridLayout in the cell, which makes it easier to handle.You will need a customCellRenderer though to make it run.How to use Tables[^] @ the Java tutorials
26 Feb 2014 by Xiao Ling
Usually, you can use "try.. catch..." to handle unexpected issues, such as I/O operation, invalid data type etc. because you don't know what will happen. Probably network disconnection, invalid file name and so on. But you'd better make some protection programmatically. For example, check the...
15 Mar 2014 by Alain Peralta
How to use getMagicCaretPosition without getting null value
4 May 2014 by TorstenH.
That is a classic homework task - please provide code.I'd go with the comment of wilkus70. you're saving the attendance each time with a save-button to the DB.So you should make an request to receive all entries which have the empID you are requesting it for.so that would be SELECT...
2 Sep 2014 by kjburns1980
This tip provides code for an enhanced version of the JTabbedPane which allows the developer to add toolbar buttons to the beginning or end of the tab set.
18 Dec 2014 by DamithSL
check below similar questions and the answers:How do I get the size of a java.sql.ResultSet?[^]How to get row count using ResultSet in Java?[^]
18 Dec 2014 by PIEBALDconsult
mysql_insert_id()http://dev.mysql.com/doc/refman/5.7/en/mysql-insert-id.html[^]
1 Mar 2015 by Kornfeld Eliyahu Peter
6.9 or better...Do this tutorial: https://netbeans.org/kb/docs/java/quickstart-gui.html[^]...
3 Jan 2021 by Richard MacCutchan
The problem is simply that you do not have a URL in your call to desktop.browse(oURL);. You try to capture the contents of turl at the time that you are creating the frame window, but there is no text there at that point. You should change your...
5 Apr 2021 by Gerry Schmitz
Create a "wizard". Creating Wizard Dialogs with Java Swing[^]
26 Apr 2021 by Richard MacCutchan
Your definitions are not valid. Try the following: JComboBox comboBoxSelection = new JComboBox(); comboBoxSelection.setModel(new DefaultComboBoxModel(new...
13 Sep 2022 by Richard MacCutchan
java.lang.ArrayIndexOutOfBound...
19 Mar 2009 by logicchild
An article to help write applet code.
17 Apr 2009 by Matt Stine
Deploying Grails with Groovy
7 Dec 2009 by ozmrdn
hi,I was creating a WS client server that is not running.I'm using Glassfish v2.1 and Netbeans 6.5.I received an error as follows:"Problem with downloading WSDL or Schema file. Check url, proxy settings or whether server is running. URL:...
7 Dec 2009 by Sriram K G
Check if you could connect to the web serivce URL via browser.
7 Dec 2009 by Richard MacCutchan
wrote:My project name is "A framework for discovering missing links in the Internet Topology"please explain this concept clearly i can't get it.How can anyone here explain your project having been given its name only?
27 Feb 2010 by SHREEKANTH P
hi i am doing project about adaptive image segmentation and image processing is this a good project....... i am using java language
28 Feb 2010 by AspDotNetDev
SHREEKANTH P wrote:is this a good projectYep.
3 Mar 2010 by Arun Reginald Zaheeruddin
Put your javax.swing.JPanel on a javax.swing.JScrollPane like this:JPanel pnlImage = new JPanel(new BorderLayout());JScrollPane spnImage = new JScrollPane(pnlImage);Then instead of placing the panel pnlImage on your container or frame, place the scroll pane spnImage on it.
3 Mar 2010 by Nagy Vilmos
From the previuous answer you were given a HUGE clue. Use a ScrollPanel, everything goes on the panel and it manages the scrolling for you.
26 Jun 2010 by bensalah
hi every one,i dont find simple drawing java app with (cut,copy,past,undo,redo)featurescan someone give me an exemple of source codethank you very much
3 Aug 2010 by Jarno Burger
its more a design pattern that you have to use :design patterns are a way of writing code that lets you do abstract (fluffy) things that also restrict you writing easily maintainable code.check memento and command pattern...check this website for the basics...
10 Aug 2010 by Tejas_Pathak
Looking at the development of other open source, even swing will find its way out.
18 Oct 2010 by faseem
I made a JFrame parent and Jdialog child. But I am not able to access the modified value of the variableof parent from the child class. code:import [swing packages needed];public class grading extends JFrame implements ActionListener{ public int me=4; //this one JTextField...
18 Oct 2010 by Niall Barr
You're creating a second grading in the child class, rather than accessing the parent class.Try replacing the lines: grading gr=new grading(); JOptionPane.showMessageDialog(null,(gr.me)+" is me from child"); //shows 4with JOptionPane.showMessageDialog(null,(frame.me)+" is me...
27 Oct 2010 by TonDRG
use crisc.ru for certification in CRISC ISACA
21 Apr 2011 by Penkov Vladimir
Shows how to use beans binding with swinghtmltemplate
24 Apr 2011 by inbaraj1988
I used JComboBox.. to remove all the items in the JComboBox. I used 'removeAllItems()' in 'ItemStateChanged' event but in runtime while changing items "java.lang.NullPointerException" error occurs.. but the component has items it's not null, but the error comes.. I can't find why..? Please...
21 Apr 2011 by Sandeep Mewara
java.lang.Null...
26 Apr 2011 by Guts_ryo
hi everyone.i have a problem pertaining to text box that do not accept any characters. Here is the situation, i have a text box that do not accept any characters, i have an onkeyReleased event that whenever i press any key in keyboard, it says, "Ooops..,this text box do not accept any...
26 Apr 2011 by Sergey Alexandrovich Kryukov
Showing this is easy, but I feel you need the code to behave accordingly, to prevent characters from entering.This is a bit less than trivial. You will need to use onKeyPress instead.See:
26 Apr 2011 by TorstenH.
- add a KeyListener to the Component you're entering the text in.- The KeyListener has to implement KeyListener and therefor the method: public void keyReleased(KeyEvent oEvent) {/* doany(); */}- the KeyEvent provides the source of the event and therefor the entered text. - update your...
16 Jun 2011 by TorstenH.
tried this?File nodefile=new File(dmtn.getUserObject());what happens if you do so? PLease also check this site: Swing JTree Tutorial[^] Section 5 is about the icons on the tree.EDIT: try this Showing the file system as a Swing JTree[^]Both will not meet your exact problem -...
16 Jun 2011 by ankit_khedekar
dont know how but this solved my problempublic Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { System.out.println("value is :"+value.getClass()); ...
9 Jul 2011 by harsh25 shah
hi... how can i set image as background image in jframe using swing ????
9 Jul 2011 by RaviRanjanKr
Given Links have same question with solutions. have a go there Setting background images in JFrame[^]Creating Frames with a background image[^]
10 Sep 2011 by Aash Maharoon
Hi,,,I am new to BeansBinding. I want to know how to do that in Netbeans IDE for swing application development as it supports for auto code generating.I followed java.net's Beansbinding project.but it was hard to understand there.Also Netbeans beanbinding tutorial.But it is not a complete...
11 Sep 2011 by TorstenH.
Google Search on the topic[^] You choose.I also can recommend to buy a good old fashioned book. Best benefit: you don't need to know a keyword to read about a certain topic.
24 Sep 2011 by aashu45
how can i arrange buttons for making onscreen keyboard using java swing?
25 Sep 2011 by Richard MacCutchan
This trail[^] should help you.
25 Sep 2011 by TorstenH.
Your Application needs a layout.Check this: http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html[^]Also please consider to use the default-windows keyboard. Windows comes with an on screen keyboard. You can call it by passing the program's name "osk.exe" to the OS.
19 Oct 2011 by VigneshPT
Is there a way to immediately stop a thread depending on a boolean variable. In my application, the ReceiveMessage runs in a while loop while(isRunning), but the boolean variable is modified by the windowClosing event. I want the thread to stop immediately when the window is closed.. public...
19 Oct 2011 by Nagy Vilmos
You can interrupt a thread with the interrupt() method.
21 Oct 2011 by VigneshPT
I tried hiding a window on closing by setDefaultCloseOperation(HIDE_ON_CLOSE); .But when I respawn the window by using setVisible(true) the window appears with size 0, and none of the components are visible. Why does this happen and what could be the solution?This is the code for...