3,978 Topics
![]() | |
Hi everyone! In my code when I click on the "Show Results" button it shows me the result is a table in another interface other than the main interface, untel now everything is fine but when I changed the method : I just want to show this table in the … | |
Hi all, yes still a question about the API! I am looking into event handling at the moment (basic things with text fields, checkboxes etc ) and I have noticed that different components generates different events which are in turn handled by different objects. As an example,let's take a checkbox. … | |
Please help to create a driver file of the given code becoz i dont know what should i do to create a driver file. import javax.swing.*; class Product{ private String PId; private String PName; private String PPrice; private String Pcategory; private String PQuantity; private String PDescription; public Product(){ PId=null; PName=null; … | |
Aoa... i m new to java.. please help me to correct this program given blew. it shows error of illegal start of esxpression.. how could b it seems as correct program please help me.. thanks alot **error: illegal start of expression JOptionPane.showMeassageDialog(null, "ID: " + ID + "name: " + … | |
hiii.. I got this strange problem.i m refreshing my jframe after every second.This jframe contains a button called addbutton.This addbutton opens another jframe.and that jframe contains a JComboBox .The problem is after every second the JComboBox is getting refreshed.I dont understand why.Before the user gets time to select any item … | |
Hi all, as some of you might know the API is my nightmare. I know it's important and therefore I am trying to use it as much as I can. Today I am looking at a program that uses buttons to change the font of some text. So, I have … | |
Hi guys. I decided to post this simple Photo viewer application. Its strictly for beginners, and cab be improved. /** * * @author Neon Tetras */ import java.awt.Image; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; public class ImageViewer extends javax.swing.JFrame { /** * Class constructor: ImageViewer */ public ImageViewer() … | |
I am trying to create a menu GUI. I am having problems with the action listeners Any help would be great. Thanks Write an GUI application that display a menu system. The menu system should allow the user to select one package, one phone, and any of the options desired. … | |
Dear i want to make a program i which when Pressed UP Arrow key cicle start moving up and when pressed DOWM key circle moves Downword Similarly left and right i have draw circle and also implements Key Listner and can anyone give me ideo how i do this task … | |
So, this code is giving me some errors, any idea? private void pintarMobs() { JButton boton = null; Component[] botones = pnCastillo.getComponents(); for (Component c: botones){ boton = (JButton) c; int ac = Integer.parseInt(boton.getActionCommand()); int a = 0; Random r = new Random(); String foto = null; if( ac != … | |
Thanks to a federal copyright law ruling on Monday by the Library of Congress, jailbreaking your iPhone doesn’t have to be kept to the underground forums like it's alcohol during a digital prohibition. The process is now completely legal under US law. Grab a glass of e-freedom![ATTACH]16137[/ATTACH]The resulting decision was … | |
Dear Team, I am writing a Swing application for my project which gets the user information and saves it in a database and then displays in a JTable. I thought like, instead of manually updating the data from our client website, why not read the data from the site and … | |
Error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at assignment.MainFrame.validateEmail(MainFrame.java:324) at assignment.MainFrame.btnRegisterActionPerformed(MainFrame.java:208) at assignment.MainFrame.access$000(MainFrame.java:19) at assignment.MainFrame$1.actionPerformed(MainFrame.java:80) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) … | |
In my high school programming class we are learning Java. We have been assigned into groups of two and have freedom to choose any project. I was wondering if anyone could come up with some ideas(games) for beginners like us. We have worked a bit in Java, I would say … | |
Hi, I have a quick question. I am making a hang man game for project (I am at university as a computer science major), I have completed most of the game but have run into one small issue which has been given me a big problem. Right now I am … | |
**I have a half complete coding which basically comes down to a gui interface. The problem is that I don't know how to get it working as ticket vending machine with fixed rates and fixed amount of cash being able to put in. So, far, I've done up to calculating … | |
Hey guys trying to make this OO but no luck..can anyone help? import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; public class Main implements ActionListener { public static void main(String[] args) { new Main();// Calling the class construtor. }//end main //Setting up ALL the variables JFrame window = … | |
Hey guys, I have a program similar to X's and O's. But I need to put the "CheckWin" method in another class and call it from there. Im having no luck, can anyone help? (CHECKWIN PART AT VERY BOTTOM) import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; public … | |
I want to create a jTree which when i right click on a node, should give me the options of "rename","add Region(parent)","add City(child)". the name of my jTree is branches As i am new to swing,Could any one help with code. Thanks in Advance. Regards, Sarkwa | |
I was thinking if it would be possible to create a JFrame, and make the title of it to change, such as make the title work as a counter that will display some text like: The window was opened for 1 second. The window was opened for 2 second. The … | |
Hello, I am testing the following applet on my webpage: import javax.swing.*; public class Hello extends JApplet { public void init() { JOptionPane.showMessageDialog (null, "Hello World"); } } My Hello.html file from BlueJ: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- This file automatically generated by BlueJ Java … | |
/* * GUI Electric Bill Program */ package guielectricbill; //import the package to do GUI input/output import javax.swing.*; public class GUIElectricBill { public static void main(String[] args) { // declare variable to store user input String accountNumber, customerName, address; int KWH; double amountDue; // Welcome customer to the Electric Bill … | |
Hi all, as much as I don't like the API, it is becoming more and more important for me to start using it. I think I might need a guide of some sort which says what's what and what's where, if anybody has one please let me know. Today I … | |
Goodday The first random number working set is a set of 3 different integers from the range 2 to 7 The second random number working set is a set of 4 different integers from the range 4 to 22 Each of these working sets may be generated as many times(at … | |
Hi all, I am having an issue with getting my Jbuttons and JComboBox alignment properly in the JPanel. I have tried changing the coordinates of the GridLayout around to try to satisfy, but they are working properly. I am trying to get my radio buttons to the far right and … | |
When I click on Button which fetch records from the database it works fine public void fetchrecords() throws SQLException { Statement stmt = null; String query = "select * from Employer where Fileno=1"; try { stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); rs = stmt.executeQuery(query); while (rs.next()) { firstNameTextField.setText(rs.getString(2)); lastNameTextField.setText(rs.getString(3)); addressTextField.setText(rs.getString(4)); //and more records. … | |
I dont understand why the image isnt appearing! please help.. import javax.swing.*; import java.awt.*; //import java.awt.event.*; public class level2 extends JFrame{ Container con= getContentPane(); ImageIcon bg= new ImageIcon("D:\\Raptor\\background3.jpg"); JLabel back= new JLabel(bg); level2(){ setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(null); setSize(1300,700); back.setBounds(0,0,500,500); con.add(back); setVisible(true); } public static void main(String[] args) { new level2(); } } | |
Hello, The program below has two JPanels. The first JPanel, panel contains the labels, buttons and combobox. The second JPanel, panel_1 has the image.I am using BoxLayout to line up the belows vertically. The issue I am having is when I run the program, the compoments of the panel do … | |
Hi This app is supposed to let a person draw depending on their choice of Shapes and color. I cant figure out what is going wrong. The colours and shapes barely work and the mouse position is not showing up at all. Mouse listener that tracks mouse position seems to … | |
Hello, In the following programs, I am trying to add multiple clients. The Client program remains unchanged. For the Server program, I am using a thread (custom class implements the Runnable interface) to open a new socket and process every client request. My questions follow the programs. **ChatServer.java:** import java.net.*; … | |
import java.awt.*; import javax.swing.*; import javax.swing.JComboBox; class grid extends JFrame { String[] Sex = {"Male", "Female"}; String[] Day = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}; … | |
   import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JComboBox; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; public class OtakuHigh extends JFrame{ private JLabel label, label1, label2, label3, label4, label5, label6, label7, label8; private JTextField text1, text2, text4, text5, text7, text8; private JComboBox Mbox, Dbox, … | |
import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JComboBox; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; public class OtakuHigh extends JFrame{ private JLabel label, label1, label2, label3, label4, label5, label6, label7, label8; private JTextField text1, text2, text4, text5, text7, text8; private JComboBox Mbox, Dbox, Sbox, Ybox, SCbox; private JButton Qbutton; … | |
I am to have the user input a temperature and have the computer output which season it (probably) is based on the temperature entered. I have written this much and when I run the program, it seems to have the user enter the temperature in an input box and then … | |
Hi, I'm trying to wrap lines in Jtree nodes, I found this code which is working good for me but a with a minute defect. On selecting Jtree node, only second half of the text is highlighted in blue leaving first few characters, I tried a lot to fix this … | |
//I want to make a program so that i can move a pawn around a board. It only has 4 positions. I am wondering how i should //go about the action listener, as in should i check using a for loop? //The pawn begins in position 0 and depending on … | |
I want to have a changing output in the 2nd textfield that is 'output' in my Action class as I enter input in the 'input'textfield. I don't know why it doesn't give any output... pls help The comboBoxes convertTo---contains "IEEE" and "DEC" while precisions contain "Long", "Single", "Double". Any advice … | |
Hi, how i can fix my code to support keyboard input? /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package calculater1; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.ActionEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; … | |
I think i have understood the basic locks , synchronized statements and methods etc etc . I would like to actually program something that used all this. Something that is prone to breaking if one is not careful , also would love if there is swing involved ( i read … | |
I need to create a Java Temperature converter. I have everthing working except when I try to convert F to C I get nothing except the value in F field is changed to 32. The conversion for C to F is working fine. Any ideas what it coudl be?? import … | |
` import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.net.URL; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; public class Main1 extends JFrame{ JDesktopPane jdpDesktop; public Main1() { JFrame frame = new JFrame("MainForm"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jdpDesktop = new JDesktopPane() { @Override public Dimension getPreferredSize() … | |
Hello, I would like to know if using Java as Programming language and Swing as GUI is enough to create a point of sale system ? Which programming language and GUI does companies use to create POS systems ? Thank you :) | |
i have written a code to out put the result of multiplication of two matrices using joption frame, but it outputs the result on separate windows, dont know how to output them on the same window. this is my code: 'public class matrixmul { /* * To change this template, … | |
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class PaymentCalculator extends JFrame{ private JPanel panelTitle,panelInput,panelButtons; private JLabel lbltuition, lblmisc, lblscholarship, lblfee; private JTextField txttuition, txtmisc; private JComboBox cbscholarship; private JRadioButton optfull, opttuition,optOther; private ButtonGroup btnpayment; private JCheckBox chkfees1, chkfees2, chkfees3; private JButton btncompute, btnclear; private JList listbuy; private DefaultListModel listmodel; private … | |
I made this program but it isn't working; any suggestions? /* * Program Name : GuessGame.java * Author : James Resue * Date : October 6, 2010 * Purpose: Write a program GuessGame.java that plays the game “guess the number” as follows: * Your program chooses the number to be … | |
package pkg1; import java.awt.*; import javax.swing.*; public class Main { public static void main(String[] args) { JFrame frm = new JFrame("Title"); JTextField txt = new JTextField(); JLabel lbl = new JLabel("To"); JTextField txt2 = new JTextField(); frm.setLayout(new GridLayout(2,2,5,5)); frm.add(txt); frm.add(lbl); frm.add(txt2); frm.setSize(500,100); frm.setVisible(true); frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frm.setLocationRelativeTo(null); } } Someone please explaine … | |
Cant find this error and all these java scripts are talking together can someone please find it. error has been noted blow. import javax.swing.JFrame; public class WindowApp{ public static void main(String [] args){ JFrame window = new JFrame("A window");//cans et the title on the title bar window.getContentPane().add(new ImagePanel()); window.setVisible(true); window.pack(); … | |
This is the code that I have done so far: import java.util.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; class TSP extends JPanel{ int weight[][],n,tour[],optDist; final int INF=1000; public TSP(){ Scanner s=new Scanner(System.in); Random r = new Random(); System.out.println("Enter no. of Cities:=>"); n=s.nextInt(); weight=new int[n][n]; tour=new int[n-1]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ … | |
Hello everybody, I have some problems with my school assignment. I need to display a picture in a jlabel and i have already some code. Can someone give me some advice how i could get it to work. Thanks in advance. Greetz MeandJava [CODE]import java.awt.*; import java.io.*; import javax.swing.*; public … | |
Using NetBeans 7.3.1 i have created a JFrame. A JLabel fills the bottom of the JFrame . The JLabel displays an ImageIcon. I want the ImageIcon automatically resize itself when JLabel resizes. Generated Code from IDE : jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Number_theory/resources/primes_ulam_spiral.gif"))); // NOI18N jLabel1.setDoubleBuffered(true); jLabel1.setOpaque(true); jLabel1.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent … |
The End.