3,978 Topics
![]() | |
I'm trying to print the necessary values in the predefined document for an example, in a Bill name in the left side and date on top right. I already had that documents with empty name and dates . how can i print the name and date to corresponding location in … | |
Hi, could some one look over my code I by myself dont get where the flaw is. It should paint 1 cube at a time but now it runs all the code through and paints all at once. package net.viped; import java.awt.Color; import java.awt.Graphics; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JFrame; … | |
I've been working through an excersise in a introduction to Java book by Deitel and I have a solution to a problem. The program will compile, but I get a message that says, "Exception in thread "main" java.lang.IllegalArgumentException: adding container's parent to itself" Can Someone please help me? Here is … | |
I want to start a collaboration with just 1 Java programmer (intermediate or pro) for building our own graphics library . I have tools for real-time collaborative code editing (a plugin for eclipse), so you don't have to worry about uploading your code on internet and then I have to … | |
Hi, I have a external class with paint(Graphics g) method and the class itself is working great. I can get it visible by launching it from my launch class by doing add(new Laatikko()); but when I am trying to get it work from third class it wont show up. Basicly … | |
In a previous thread i had described a problem i had to transfer a frame or panel and all it's components as an image into a buffered image. I thought i had found the solution but it seems i am doing something wrong. In line 162 i call the method … | |
Hey, Guys and gulls i need help with the following asap. I'm trying to code a checkers board in java and populate it with checkers and then paint this onto a JPanel. I then add the JPanel to my JFrame. I am able to draw my checkers board and populate … | |
import java.awt.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import javax.swing.*; import java.io.*; public class one extends JFrame { public one() { JPanel p = new JPanel(); JLabel l = new JLabel(); setTitle("ScrollText"); setSize(600, 400); setLayout(new BorderLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); BufferedImage image; p.add(l); add(p); try { File file = new File("D://Photos//foto(222).jpg"); image = ImageIO.read(file); … | |
I am trying to update database by editing cell values in jtable. my table looks like  When i edit the value in particular cell and without clicking anywhere if i click on Update button the database is not updated as like this !  but if i … | |
Hello everyone,I have little problem over here with my work. It gives null pointer about JTextArea in ActionListener. Could anyone help me,please? Thanks in advance Here's code: import java.awt.event.*; import java.io.*; import javax.swing.*; /** * @author Nikola * */ public class FileListener implements ActionListener { private JMenuItem exit; private JMenuItem … | |
//Application Forms import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.GridLayout; import java.awt.HeadlessException; import java.awt.Panel; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Vector; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.TableCellRenderer; … | |
i want to send large files,,,,,this program only send upto size:1024*1024 ,,,,plz help me out!! client- import java.net.*; import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; class ftpclient extends JFrame implements ActionListener { JButton b1,b2; JTextField t1; ftpclient() { b1 =new JButton("Select File"); b2 = new JButton("Send File to Server"); … | |
I'm getting an error that I don't understand. It's a Null Pointer Exception, but neither of my arguments in line 118 is null. According to the documentation, ImageIO.write will throw a IllegalArgumentException or an IOException, but it isn't throwing either. I'm not sure what could be null here. You can … | |
Hi, I'm trying to write some code that will draw a filled in black circle at the coordinates where the mouse is clicked. Here is what I have written so far, I can currently get the coordinates of the mouse click point but nothing is displayed. I also get an … | |
Hello everyone, I am building a tic-tac-toe game for my final and everything is going smoothly except for one problem. The names I ask the user to enter at the beginning of the game, a replaced with null when the messagebox that shows who won appears. Here is the code, … | |
there are two panel in one panel there is search button and in the another one there is Jtable for displaying search result. In that jtable initially all the records are displayed. But when i try to search, it works but the problem is that i need to click search … | |
![]() | I created a JTree and also created a class which implements `TreeSelectionListener` then I pass that object into the JTree's function `addTreeSelectionListener`. In the [JavaDocs](http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TreeDemoProject/src/components/TreeDemo.java), there is an example where they implemented the function `public void valueChanged(TreeSelectionEvent e)` within the main class and passed `this` into `addTreeSelectionListener`. I tried to … |
hi all, i am building a squared pyramid calculator and writing all the code from scratch, but I seem to have run into my first problem though. i am giving the user a welcome message and then giving them a dropdown menu asking them what they want to "adjust" for … | |
I want to update the contents of Jtable as shown below when the Jcombobox's item state is chaged in the left panel. but i am not being successful in it .Please help.  when the table no value is changed in the left panel , i want corresponding Jtable … | |
I need to update the items of JCombobox from the database during runtime. I had made the JCombobox editable and what i need to do is type something in the editable combobox and search the database and only display the items matching the text. For example there are if i … | |
Hi, Im really new to java and i'm trying to write a simple rock paper scissors game, and i'm having a problem. I have to incorporate a JOptionPane three button box where the user selects either rock, paper or scissors. The problem is that i don't think im retrieving the … | |
I have trouble trying to create a clock java program that asks for user's input for hours and minutes. When it asks the user for their input, the clock program is suppose to set it to that time using the hour hand and the minute hand, but for some reason … | |
Hello everyone, Im new to this forum and sort of new to Java aswell. I'd like to ask you to comment on the way I practise Java and also hopefully solve this **"Start: Applet not initialized."** error. I have not tried to run this through browsers because i didn't create … | |
i have been confused lately regarding where to concentrate... java or c++ or Algorithms & data structures or ........(there are still more languages) whenever i concentrate on java i tend to forget c++ or various algorithms or assembly( i have learned 8086/8088 programming). java is very large...core java......file io....swing..servlets....enterprise java...and … | |
hi i'm having trouble with this rock paper scissors program looping correctly. Ok so first of all that game is a simple rock paper scissors of the user against the cpu. The program begins by asking the user what choice he/she would like from a dropdown menu rock. paper or … | |
In this program I'm attempting to visually represent a selection sort using an array of rectangle objects. If the program worked as intended, the rectangles would sort themselves from least to greatest, with two rectangles switching spots and the array being repainted each time through the selection sort loop. As … | |
Hello I am running into an error after creating the jar file. I get a message stating that the main class to my program could not be found when in fact there is a main class. If someone could give me a hand and lead me in the right direction … | |
Hey guys, i've been making a little super mario clone in Java but I need help, you see, if you download it and play it, you will notice it is quite stutter-y, and that really shouldn't be the case since it's such a small program. game link : [Click Here](http://www.filefactory.com/file/4mx7jddejnrr/n/super_mario_clone.zip) … | |
When "ENTER" button in value class clicked the show class wil be run. but nothing happend import java.applet.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; /*<applet code ="value" width=200 height=200> </applet>*/ public class value extends Applet { private JLabel lab1; private JButton btn1; public void init () { // Construct the … | |
I havent done java in a while and not sure what to do with the void methods please can someone help me out thanks whole thing is in a zip file as well done in bluej as there is a long list of code here. /** * class Player * … | |
This program is one part of the GUI part for my reminder program. I would like to update the JTable which shows all the task and will refresh every 2 second. I have questions... (1)the SwingWorker never executes( I put println in the code but it shows nothing ) How … | |
Hi, I am running Java 1.6.0_31 on my machine and would like to have "Nimbus" set as the default look-and-feel for my Java applications. I have followed the instructions obtained from the Oracle java website i.e. by creating a text file named **swing.properties** with the following line of code **swing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel** … | |
I get this error. /*array dimension missing new ImageIcon [] = getClass().getResource(name[0]),*/ ^ and I dunno what's missing. and not sure if anything else is wrong because for now there are 4 erros for name[0],name[1],name[3],name[4] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.Container; import java.io.IOException; import java.io.*; import java.awt.BorderLayout; import … | |
im a begginer with the gui code , i tried to add an image by making an imageicon then adding it to a Jlabel nd finally adding it to my frame all this while trying to put a button in front of the label but i cant seem to get … | |
import javax.swing.JOptionPane; import java.text.DecimalFormat; public class payrate { public static void main(String[] args) { String str; String name; double horasT; // horas trabajadas double rate; // rate por hora double salarioB; // el salario bruto name = JOptionPane.showInputDialog ("Entre le nombre del empleado: "); do { str = JOptionPane.showInputDialog("Entre las … | |
Hello, I would like to get some help please. I am a newbie in Java and i am stuck. Actually I wrote a code in which i want to draw a circle and then move that circle downwards like free fall. I can deal with the coordinates but i don't … | |
In this code i did not understand something. In one class, a variable is declared as private, but then this value is used in another class. import java.awt.Graphics; import javax.swing.JPanel; public class DrawRect extends JPanel { private int choice; //user's choice of which shape to draw. public DrawRect (int userChoice){ … | |
It compiles but my JButton won't work... when i run the applet and press the Exit button.. it just prints some errors(or i dunno what they are) in the black window that opens when you run the applet. import java.awt.event.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; ; public class CheckRadioTest … | |
This only does either BOLD or ITALIC... import java.awt.event.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.applet.*; public class CheckRadioTest extends JApplet implements ItemListener { //private String CurrentComboName = "Select One"; private JLabel headingLabel; private int currentStyle = Font.PLAIN; //private int intBold = Font.PLAIN; //private int intItalic = Font.PLAIN; private … | |
I tried to convert this GUI to a JApplet but then I get the error message. > D:\JAVA\PROGRAMS\whiteboard\whiteBoardapplet.java:9: error: whiteBoardapplet is not abstract and does not override abstract method actionPerformed(ActionEvent) in ActionListener > public class whiteBoardapplet extends JApplet implements ActionListener > ^ > 1 error > > Tool completed with … | |
This is a JApplet. the Radio Buttons for colos work.. why won't the Checkboxes work? import java.awt.event.*; import javax.swing.*; import java.awt.*; public class CheckRadioTest extends JApplet implements ItemListener { //private String CurrentComboName = "Select One"; private int currentStyle = Font.PLAIN; //private int intBold = Font.PLAIN; //private int intItalic = Font.PLAIN; … | |
Hello, I need to create a JDBC that connects to a mySQL database, retrieves the data from a table and displays it into a JTable. I have done this successfully, but have ran into a problem. The initial values I entered into the database (for testing) are permament. If I … | |
OK so what would I need to change to the following code so it would produce the following: xxx xoo xoo As at the moment it is producing: xxxooo xxxooo xxxooo My code that I have used can be seen below: import javax.swing.*; public class test { public static void … | |
Im creating a Chess game. Im stuck at getting the pieces to move within the rules Aka bishop can only move diagonally. I Create Panels - 64 of them within a lager panel then add JLabels - The pieces - into those panels ` JLabel bb = new JLabel(new ImageIcon("bb.gif")); … | |
I am newbie in java. I am facing problem now. My purpose is to put the time in textfield. I need press "Start" button and then the time will start go. But after i compile this code. It got error. I have no idea to do it. Can anybody help … | |
I was trying to reduce my jtextfield height, since it is for user to enter first name. somehow when i run the code, the box is just too big, is there anyway to change the textfield height? i tried with setPrefferedSize but somehow it showing error, mayb i put it … | |
package newsatranc; import java.awt.BorderLayout; import java.awt.Color; import java.awt.ComponentOrientation; import java.awt.Cursor; import java.awt.GridLayout; import java.awt.event.InputEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import java.util.Map; import java.util.TreeMap; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JToolBar; import java.awt.Dimension; public class NewSatranc extends JFrame { private static … | |
I have problems with adding images to JFrame java application. Now I am using Eclipse IDE. Below is the code that no images is shown. import java.awt.BorderLayout; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JFrame; public class LabelDemo { public static void main(String[] args) { JLabel northLabel = new JLabel("North"); ImageIcon labelIcon … | |
Hello ,,, am having trouble while making a drag and drop label i wrote a code i'v seen on youtube , but after compiling i had punsh of Exception and i don't know why !! can any one help me writing a drag and drop code , i'll post the … | |
Hey guys, I'm trying to develop a simple tool. I'm having but I'm having trouble accessing some swing components. My gui basically has a jtabbed pane with two, jbuttons beneath it. Each tab is identical except for the title, it has a jtextarea and two jbuttons. These buttons perform an … |
The End.