3,978 Topics
![]() | |
Hello, I'm in a pickle. (Please observe the code) In the actionPerformed method, I don't know how I can get the value of the variable 'minutes'. I can get 'hours' by e.getActionCommand(), but can't do minutes that way. I need to get both 'hours' and 'minutes' at the same action. … | |
Hi guys, i dont think im using the boolean and break correctly i need it to see the tutormin>=240 and then throw the error and stop without exiting the program. can someone take a look and help me edit it import java.awt.*; //imports all Java.awt import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import … | |
**This program is supposed to read data in from a file into an array list and everything compiles correctly so far but when i go to run the applet ProcessNovels it shows a blank window saying "Start: applet not initialized? Im not sure where the problem actually is i am … | |
import java.applet.Applet; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; import javax.swing.JFrame; public class StartingPoint extends Applet implements Runnable, KeyListener{ public static void main(String[] args) { StartingPoint sp = new StartingPoint(); JFrame frame = new JFrame("My applet, as application"); frame.getContentPane().add(sp); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); sp.init(); sp.start(); frame.pack(); … | |
Ok so im writing a small java application using Zellers Algorithm to work out the day of the week for a given date. I have never compiled a java program before because i'm still moderately new to the language and IDE's etc. I am using netbeans. I have tried to … | |
I keep recieving an error on lines of code 77-80 and I'm not really sure what I'm doing wrong. They're all the same error and goes as follows: ----jGRASP exec: javac -g Program5.java Program5.java:72: error: cannot find symbol adultTickets = adultTicketPriceTextField.getText(); ^ symbol: variable adultTicketPriceTextField location: class Program5.buttonListener Program5.java:73: error: … | |
Hello, I am unable to register the right key event from this program. Besides setting the focus of JPanel to the KeyListener, I am not sure what else can be done. I will be grateful for any help. Thank you! import java.awt.*; import java.awt.event.KeyListener; import java.awt.event.*; import javax.swing.*; public class … | |
hi Guys, I am currently coding for a GUI based program that delivers the amount of time a tutor works in minutes and the amount they go paid total, giving them details on the amount of time work total, and wage per hour and if it is below, minimum, or … | |
basically my program runs like this 1. open up configure GUI 2. get congiguration 3. close configure GUI 4. open up main GUI now when I am testing in netbeans, this works perfectly however, as soon as I compile and try to run the jar file outside of netbeans the … | |
Hello, The program below selects two shapes at random from a choice of four shapes (line, rectangle, oval and rounded rectangle) and draws them onto an applet. Once six such shapes have been drawn, the screen is cleared and the above process continues indefinitely. The issue I am having is … | |
Hi folks, I have been making a marquee scroller that reads the text coming from the right to the left, so setting a JLabel's text using setText() starting with 60 spaces and one character-long substring, to zero spaces and 60 character-long substring. I've noticed that immediately, the jlabel's text starts … | |
so my project is about handling images. we have back end codes in c. now we need a GUI.. in what language should we create our GUI so that we will be able to connect our c code with the GUI? swing , vb.net?? i have no idea | |
This is my Java code at the moment (using netbeans IDE), I have tried to set th value of cell 4,4 to A in the following code, `outputCadence.getModel().setValueAt(items.A[5], 4, 4);` , however this does absolutely nothing, I'm a bit of a noob so I'm not sure if I'm missing something … | |
Hey Guys, This is my first program where I have used JLabel and JText. Im trying to create a program that will solve a simple quadratic equation. I have the program to the point where it will solve the equation, I just cant get it to display in the window. … | |
Hi guys, i am writing a GUI program that will take a tutor minutes and earings and create an average earnings. My problem is instead of it using what we type in the fields E.g 200 mins and 50 dollars earnt and displaying the average. It shows the default fields. … | |
I need to sort the display by name in alphabetical order. How do I do that? public class Node { String name; int age; String position; int salary; String num; Node next; Node() { name = null; age = 0; position = null; salary = 0; num = null; next … | |
i found this code for pacman i want some one to explain me how it works i am new to java game programming so my doubts might be silly for few of u i just understood the array part of creating the maze i have written all my doubts thank … | |
Hello everyone!! I really need some help! I am trying in implement a tic tac toe game made of different classes in which the board can be expandable. I have most of it figured it out but after I ask the first player for their move it ends the game … | |
So this is my first attempt at a GUI in swing, and so far things seem to have been going somewhat smoothly. However I am un-able to update a JList named objectsL. I imagine this is because I have already added it to a panel? So, now Im am very … | |
Okay, so I'm working on a battleship game, and I added these two tables which are throwing all sorts of errors, like: * Illegal Start of Expression, * Not a Statement, * ';' expected, * ']' expected, * <identifier> expected. I have no idea why... Help, please? import java.awt.*; import … | |
Hello, I need help making a table based off my tax code I made, the tax code was a little, but I need help with the table part also. The table should look like this: Income Single Married Joint Married Separate Head of house 50000 9846 7296 10398 8506 50050 … | |
**Can any one explain this library of java for me?** | |
Hello, I am facing this difficulty here : First I'll give code public class Game extends JFrame { private JPanel contentPane; //private JPanel settingPane; protected JLabel lblPlayerName2; // I am using this one for my testing JLabel[] lbls = new JLabel[9]; private final ButtonGroup buttonGroup = new ButtonGroup(); public static … | |
Am trying to draw image on jpanel or jlabel when button is been click on, so i added actionperformed on my button as follows. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Image imag = new ImageIcon(this.getClass().getResource("img/top_bg.jpg")).getImage(); showPix1.setLayout(new BorderLayout()); showPix1.add(new paintPhotos(imag,20,20), BorderLayout.CENTER); } I have a … | |
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Bank1 extends JFrame { private JLabel l1; private JLabel l2; private JTextField t1; private JPasswordField p1; private JButton b1; public Bank1() { super("Bank System"); Container container = getContentPane(); container.setLayout(new FlowLayout()); l1=new JLabel(" ID :- "); container.add(l1); t1=new JTextField(25); container.add(t1); l2=new JLabel(" Password … | |
Like me you may be curious about the "closures" or "lambda expressions" that were supposed to be in Java 7 and are now the centre-piece of Java 8 (due next year). Also like me you may have Googled for some info, and discovered a smattering of technical articles explaining the … | |
i need help finish this program for an assignment, It should play the Rock, Paper, Scissors game. The nextPlay methoded needs to be filled in with nested switches. thanks for your help import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Rps extends JFrame implements ActionListener { private final char moves[] … | |
**I am doing a mini project, I need help with how I can store the scores in an array. ** import javax.swing.*; // import the swing library for I/O class fi_project { public static void main (String[] param) { questionfilm(); System.exit(0); } // END main //************************************************************ public static void questionfilm() … | |
so i now awt is the old version. which is Applet swing is the new version which is JApplet. code at bottom, is it normal to mix awt and swing? for ex i am using continer which is awt. and let say i dont want to mix awt with swing … | |
So I am trying to make a tile map editor/reader to create and interact with maps like [this](http://www.codeproject.com/KB/game/Autotiles_Algorithm/TileMapExample.png) , so essnetially I am wondering what the best way to go about this would be. I have not done anyhting graphical in programming in a long time and yeah, I was … | |
I want to align two text in same line first text should be in left side another one should be in right side of java swing textpane. so I have using style interface and Styleconstants class to align text but it couldn't worked. I have applied some other styles on … | |
Hello friends, I have created three JComboBoxes. first two of them get list from string. However I select these two comboboxes, the third combobox automatically retrieve data of a particular column from my database. But in my code its only get data from first item which automatically seleted by setmodel … | |
import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; class work { // main method constructs the Frame window public static void main ( String[] args ) { CircleWindow application = new CircleWindow(); }// end of main method }// end of Line app class CircleWindow extends Frame { private int nSeconds … | |
` Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at finalprojectintersection.ProjectGUI.findbuttonActionPerformed(ProjectGUI.java:278) at finalprojectintersection.ProjectGUI.access$000(ProjectGUI.java:26) at finalprojectintersection.ProjectGUI$1.actionPerformed(ProjectGUI.java:133) 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:3321) 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) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703) … | |
call method from another class Hi , I'm almost done with my practice paper I have done with the first part and now I'm working in the second part I came to this question and I stopped and didn't know how to call method from another class here is the … | |
import javax.swing.* ; import java.awt.event.*; import java.awt.*; import java.io.*; import java.util.Calendar; import java.util.*; import java.text.*; import java.util.Date; /* <applet code="gui.class" width=250 height=100> </applet> */ public class gui1 extends JApplet implements ActionListener { JTextField t1,t2,t3,t4,t5; JLabel l1,l2,l3,l4,l5,l6; JButton b1,b2; Calendar c1,c2,c3; JPanel p,p1,p2; Date sd,sd1; SimpleDateFormat sdf; public void init() { … | |
Hi guys, i am trying to add a image as the background for my project but cant get my code right, heres what I got so far //beginning of 1 import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.image.BufferedImage; import javax.swing.JPanel; /** */ public class makeB extends JPanel { private BufferedImage buffer; private … | |
Hello I'm tring to creat a specific Look in my Java JUI but my code is giving me errors when I try and launch it. Here is my code please take a look and tell me where i'm going wrong. Its a simple login interface for my program: import java.awt.*; … | |
I want to add another Page to my Applet when clicked Submit, and to be clear need to retrieve data from the server where data is logs. please let me know what shall i do. package com.stage.logs; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.applet.*; import javax.swing.*; import javax.swing.plaf.TextUI; public … | |
I want to create a windows appliation in java using Swing in Netbeans. I want to create the student maintenance details, with Mysql as backend. I dont know how to load the frames in single form. Example, if the user give user name and password in the text box and … | |
Ask an user to type in a password, a qualified password should follow the constraints, such as: Length of password >= 8 Include at least one uppercase character Include at least one lowercase character Include at least one integer Include at least special character Write a program to check if … | |
import javax.swing.* ; import java.awt.event.*; import java.awt.*; import java.io.*; import java.util.Calendar; import java.util.*; import java.text.*; /* <applet code="gui.class" width=250 height=100> </applet> */ class gui extends JApplet implements ActionListener { JTextField t1,t2,t3,t4,t5; JLabel l1,l2,l3,l4,l5,l6; JButton b1,b2; Calendar c1,c2,c3; JPanel p,p1,p2; Date sd,sd1; SimpleDateFormat sdf; public void init() { SimpleDateFormat sdf = … | |
/*I am trying to generate 6 random unique (1-49) no.s and understand that my validation is incorrect.Help Please?*/ [code] import java.util.*; import javax.swing.JOptionPane; public class ranUnique { public static void main(String[] args) { String output=""; int[] arrayRan=new int[6];int ran2; for(int ran=0;ran<arrayRan.length;ran++){ arrayRan[ran]=(int)(Math.random()*50 //validate for(ran2=0;ran2<=ran;ran2++){ if ((arrayRan[ran]==arrayRan[ran2]) || (arrayRan[ran]==0)) { arrayRan[ran]=(int)(Math.random()... … | |
Hi! I'm a 2nd Year IT Student and right now I have a problem in creating an Address Book Program using Java Codes.. It has never been discussed to us in class so i really don't know how to do it but look for it online.. I have used Mr./Ms. … | |
Hi, I have a desktop app in Swing. Now i want a javascript function like mailto when I click a JButton. Please help or provide any suggestion on my approach. Thanks in Advance. :) | |
this is Sudoku.java this is the main class. Reminder does the time keeping, the SudokuBoardDisplay displays the board and draws images. The one who handles the logic is the SudokuModel How do I make the images clickable and do something. how to display the remaining time as JLabel ....? i … | |
I want to start as junior in Java in a company but they ask me to present them some tasks that ensures that i am more than a junior.they offer me a task to create a Swing Gui with buttons and stuff.I have already a good knowledge of Java from … | |
All, I am using Netbeans 7.2 to build a form. I added a Swing JTextArea to my form and all is well. I'd like to add a titled border to my JtextArea (or the JScrollPane in which it lives) but can't figure out how. I tried Right Click > Properties … | |
I am not to sure what the error is in my code but the order variable does not seem to initialise properly and hence my gui displays the wrong output, for example when cheese,tomato and chicken are selected it only displays Chicken with Tomato Tomato $12.75. Any help will be … | |
Hey Guys, Im new to learning java and I am writing a few programs for practice. I cant figure out whats wrong with my code. When i try to compile i get an "error . class expected" Any advice is appreciated, thank you. import javax.swing.JOptionPane; public class TuitionCost { public … |
The End.