3,978 Topics
![]() | |
[CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Calc extends JFrame implements ActionListener{ JFrame frame; JPanel textfield1,textfield2,rowpanel,calcb,mainpanel; JTextField display; JButton[] b; public Calc(){ frame=new JFrame("Calculator"); textfield1=new JPanel(); textfield2=new JPanel(); display = new JTextField(16); mainpanel = new JPanel(); textfield1.setLayout(new GridLayout(4,6)); textfield1.add(display); textfield2.add(textfield1); //array String[] cbuttons = {"7","8", "9","/", "4", "5", … | |
I just finished this project, thought I had it done, but on line 1, it's telling me, "incorrect Package". What am I missing here? [code] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; public class JavaNotepad extends JFrame implements ActionListener, KeyListener { boolean txtChanged = false; String fname = ""; … | |
Please help me with this assignment as well, because I am receiving a error when Running the application. The error I am receiving is: Exception in thread "main" java.lang.Error: Do not use Stock.setLayout() use Sto ck.getContentPane().setLayout() instead at javax.swing.JFrame.createRootPaneException(JFrame.java:458) at javax.swing.JFrame.setLayout(JFrame.java:524) at Stock.<init>(Stock.java:50) at Stock.main(Stock.java:36) Press any key to continue … | |
I must write a interface to enter course information for transfer students. The created data file should be sequential in nature, with the student's name, his/her ID number, the course number from the previous college, and the accepted course number at the current college. The code I wrote so far … | |
Hello, I've been working on a fun project of my own. I didn't really start out with a plan in mind, but now it has turned into an attempt to make some Advance Wars type TBS game. The problem I ran into is trying to display the base "terrain" image … | |
I have successfully completed a project that I have been working on. However, I want to clean the image up slightly. This code consists of 2 different calculators and I would like to divide them with some sort of divider. Can anyone assist? Any help is greatly appreciated. [CODE]import java.awt.*; … | |
...Can anybody knows how can I put a table on what type of Package type (overnight and two day package) in my program.. Since I have been troubled on how I would like to display my added data to an array and if I have choose a certain package type … | |
what is the code in inserting picture in a java window. can you give me a sample java code showing a window and a picture with it...i want to create a photo gallery using java.swing | |
![]() | Hi, I am trying to develop a GUI application that has a text area for a 10 digit number. I would prefer to right click on the field and select a max length and "number type" instead of coding an 'if function on keypress' and so on. Is this possible? … ![]() |
Hi guys.. I am currenly coding a program which outputs the next state table for flip flop circuits. I have already finished the the generator for one type of flip flop, and I have 3 more to go.. So far, my arithmetic parser is working good but I suddenly remembered … | |
This is a program for generating a state table for flip flop circuits. My problem is that the program does not get anything from the Textfield which gets the value for KAEquation, but for JAEquation, it works just fine. [CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; /** * @author Jenielle … | |
Hello all, I'm trying to add a multiple JTextFields onto a single JPanel that has been already initialized thanks to the Design tool from the JFrame. I'm pretty sure that I already added them and I'm not getting any errors but they aren't showing up when I execute the program. … | |
I have been troubled about my program how to put some funtionalities regarding on my buttons can anybody can help me? In button compute I have to put some computation regarding on (weight*perounce)+others; then for the button clear I have to clear all the inputed data in the textfield; then … | |
im not a little bit familiar with c program.....so can u help me to change this program to c program......pls ASAP.. here are the code: import java.awt.*; import java.awt.event.*; import java.net.*; import java.io.*; import javax.swing.*; public class TicTacToeServer extends JFrame { private byte board[]; private boolean xMove; private JTextArea output; … | |
Hey guys, This is my first topic. I tried my very best to keep behind the scenes and not make a thread about this, but its been ticking me off for a while now.. The "while" loop im using.. i can only get the last user input to display or … | |
[CODE] import javax.swing.*; import java.awt.*; public class Calculator { public static void main(String[] args) { new Calculator(); } public Calculator() { JFrame f = new JFrame(" "); JPanel textfieldpanel1 = new JPanel(); JPanel textfieldpanel2 = new JPanel(); JPanel row1panel = new JPanel(); JPanel row2pane1 = new JPanel(); JPanel row3pane1 = … | |
I have try to get used to the database -java connectivity with a simple address book application below : [CODE] import java.awt.*; import java.awt.event.*; import java.sql.*; import java.applet.*; import javax.swing.*; /////////////////////////////////////////////////////////////////////////////// //Creates the main window with top Menu toolbar. //This is also the class for the main declaration ////////////////////////////////////////////////////////////////////////////// public … | |
I can't figure out why this won't put buttons 1, 2, and 3, on the top of the frame, with buttons 4, 5 and 6 on the bottom? I realize there should be space between the top row and the bottom row. import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; … | |
i need to a Scroll bar or JScrollPane to My Jtree... I have googled and gone through several examples, but non seemed to have worked... Please can some one help me to solve this problem .. I simply need to have scrollers when the content of the JTree increases .. … | |
Hi i am using netbeans to make a tictactoe game so far this is my code: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TicTacToe implements ActionListener { //Class constants private static final int WINDOW_WIDTH = 400; private static final int WINDOW_HEIGHT = 400; private static final int TEXT_WIDTH = … | |
Hi ive been working for a few days now trying to figure out how to make it so when a button is pressed in this game instead of just a simple X or O showing up an image of lets say a dog for X and a cat for O … | |
Alright I have created an object, its a simple object. Basically just textfields and a combobox. I have them all in a gridbag layout with weightx and weight y set to one so that they fill out the panel I place them on. [B][U]Question 1:[/U][/B] What I'm wanting to do … | |
ok now what i want out of this program is to be able to ask the user how large the height and width of the drawing should be. (i seem to have this down ok or at least i think i do) i also want to be able to have … | |
hi i am new to java programming and im working on a looping program involving the fibonacci numbers. what i would like to do is to have a program that asks the user how many values of the Fibonacci sequence to output. Then i want to create a loop that … | |
hello I'm haveing alot of trouble here, i couldnt figure out how to get the pie to reflect my amoritization output using on only 2 slices and I haev to hand in something today so I thought I would jsut color the 4 sections with representative colors. If a person … | |
I'm using documentation on sun.com to try and learn Java. I was trying a simple Notepad type program but cannot get the menus to display. I'm receiving no errors and cannot figure out what I've done wrong and/or left out. [code] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class NotepadInJava … | |
This is really frustrating. Whenever I run this, a blank window frame appears The components only appear when I click the edge of the frame. Please check if I did something wrong: [CODE] import javax.swing.*; import java.awt.*; /** * */ public class FFGen{ public void First(){ /** * @param args … | |
I need help once again. I am new in this course and are still battleling with some of the work. I wrote a code for Displaying Stock Information, however it's giving me a error. Please help? /* Chapter 8: Programming Assignment 9 Programmer: T. du Preez Date: September 20, 2009 … | |
Hello eyeryone, I am wrking on a project which deals with building avionic GUI like metres,gauges etc.. i was not able to create the exact look and feel using the java swing standard libraries, please tell me any other alternative for creating such GUIs like[B] activex[/B] and wheather i can … | |
I am trying to create an inventory GUI display for scool. I have this GUI class as part of a 4 class program. For some reason I thought that the last lines created buttons yet this program lacks them. I also hav problems having my main call the GUI to … | |
I'm toying around with Java trying to familiarize myself with the basic GUI stuff. I can't get my program or my text field inside of it to center on the screen. For the Simple... file, I've tried using the [code]theTextArea.setLocation(15, 30);[/code] and [code]//theTextArea.setAlignmentX(CENTER_ALIGNMENT); //theTextArea.setAlignmentY(CENTER_ALIGNMENT);[/code] seperately. When I have either of … | |
hello, I'm a beginner and I'm trying to create a mortgage GUI and I'm having some trouble trying to figure out why the variables in my ActionListener are not read. can someone assist? here is my code: import java.awt.Container; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import … | |
Hi, I'm trying to print a string on the center of a window using GridBagLayout. All I see printed is a part of the string I expect (the current month) instead of the whole string. I don't seem to be able to spot where the error is and I'd appreciate … | |
I am developing sudoku. Random numbers are generating but i want to place rthem into particular fields. here is my code [code= java] package sudoku; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import … | |
Hi. I'm having alot of trouble completing this part of my assignment. can u please help me with it the ques is : Implement the following buttons: Rect, Oval, Image, Colour, and Clear. You do not need to have the Text button or its associated textField. Your Rect, Oval, and … | |
This supposed to return the user's BMI. But the output is always 0. Why is that? [code=java] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.DecimalFormat; public class bmi extends JApplet implements ActionListener { JTextField inputLbs, inputInches, displayBmi; public void init() { JLabel labelLbs = new JLabel("Weight (lbs):", SwingConstants.RIGHT); inputLbs = … | |
Hi All, I teach java to 2nd year students who are doing a very basic module on GUI and applets, without any animation etc. I need to give the class an individual mini project. Please could people suggest possible project ideas for a 2nd year CS. The syllabus does not … | |
I am trying to write a code for the following: Write a Swing program that declares an empty array of grades with a maximum of 50. Implement a JOptionPane input box within a while loop to allow the user to enter the grades using a -1 as a sentinel value. … | |
The scenerio is that I have different type of drawing components on drawing area. In menu I have some combo boxes which apply different properties on these objects. and also add a new UndoableEdit to the UndoManager. Anybody worked with the swing's undo package will get the idea. This way … | |
Write a Java Program that prompts the user to enter his/her first name and last name, then displays a message to welcome the user into the class CIS 226. If the user hits Cancel on either first or last name, show the error message: [code] import javax.swing.JOptionPane; public class Assign2 … | |
Hello. I'm trying to make a calculator with JFrame. I'm only gonna make the appearance of the calculator (not functioning). The numbers and operators are supposed to be arranged this way: 7 8 9 + 4 5 6 - 1 2 3 x # 0 * / however, I only … | |
Hi, I have a table with JButton for browse and a JTextField to display the selected file. How can I set the selected file to the text field in JTable? when one more button "Add"(not part of table) is clicked, a new row should be added to that table and … | |
Many years ago I was wandering through some SNMP code trying to port it to a Rabbit 2000. I'd guess that not many are familiar with this device -- it's an 8-bitter, and I had no operating system or dynamic memory. So there were several issues in addition to the … | |
What I would like to do is to add a dropdown menu instead of having the buttons for the three loans. I tried a few different things but just cannot figure out how to do this and get it to work. Please can someone help? Here is my code with … | |
Hello guys, I don't really need a solution, just answer - some Swing insight. So I have a panel, and a list on it. The list is populated with strings. The problem is the following: If I add the list elements too fast, I end up with different kinds of … | |
I m doing Program for sudoku. The blank grid displayed but how to pass random integer values to that grid. here is my code: [code=java]import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.*; import javax.swing.JFormattedTextField; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.NumberFormatter; @SuppressWarnings("empty-statement") public class Board { private static final Dimension FIELD_SIZE … | |
So Apple has taken the rare step of announcing it's not going to update its range by the end of this year. It's done this because the rumors have been floating around for so long - people were expecting a new iMac and a new Mac Mini to come out … | |
The initial model for looking at Twitter was horizontal -- see everything that all the people you follow are thinking about. Now the model has been turned on its head 90 degrees -- see everything that anyone says, whether you follow them or not, that has to do with a … | |
GUIdancer 2.2 Automates Failure Retires If at first you don't succeed, try, try again. Such is the way of GUIdancer 2.2, the latest version of the function-test automation tool from Bredex, which began shipping yesterday. The keyword-driven tool for Java (Swing, SWT and RCP) and HTML can now retry failed … | |
MindTouch [URL="http://wiki.mindtouch.com/Press_Room/Press_Releases/2008-07-23"]announced today[/URL] at the [URL="http://en.oreilly.com/oscon2008/public/content/home"]O'Reilly Open Source Convention[/URL] (OSCON) that a new version of its collaboration app MindTouch Deki "Kilen Woods" is ready for its close-up. Though it seems lately like you can't swing a cat (not that I would) without bumping into a new collaboration tool or suite … |
The End.