I am working on a java program that will read a text file containing integers separated by '@', in the format @123..90@123..90@ vertically aligned in the file. After reading, it outputs those numbers in a grid format. I want to get this output on a separate AWT window. As I am new to AWT concept in java. I want some help to know as to how I can go about doing this. I am able to get the AWT window with a blank screen, but coudn't figure out how to incorporate the output into the AWT window.

Member Avatar
Member Avatar
+0 forum 1

Hello, I would like to develop a sprite editor. Therefore I have programmed a software like paint. As you can see on the picture, on the right, there is a canvas with a grid on it. I use a GridBagLayout to manage every widgets inside my window. The canvas is represented by a JLabel which is inside a JLayeredPane. I have set the size of the JPanel with setPreferredSize. It works well with my screen resolution because there is enough space to display the canvas. However on smaller screen, it doesn't show up. Any idea on how to adapt the …

Member Avatar
Member Avatar
+0 forum 1

Hello, I was hoping someone can help me, im looking for a way to extend a basic shape class in particular the roundedrectangle2d class and be able to draw it in the same way we could handle an object with a simple call to g.draw(object instance); However im having problems with it not being drawn to the canvas, i only see a gray rectangle for the code below : import java.awt.BasicStroke; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; public class objectView extends JComponent { private static final long serialVersionUID = 1L; public objectView() { } …

Member Avatar
Member Avatar
+0 forum 2

** //When an item from the list is selected, a checkbox along with the drawn graphics schould appear. but only the graphics appear. Help? *basic** import java.awt.*; import java.applet.*; import java.awt.event.*; import java.awt.Checkbox; public class GetSelectedItemExample extends Applet implements ItemListener { Choice c; CheckboxGroup g1 = new CheckboxGroup(); Checkbox checkBox1 = new Checkbox("Red"); public void init() { c = new Choice(); c.add("Select Option"); c.add("Primary Colors"); c.add("Secondary Colors"); c.add("Tertiary Colors"); add(c); c.addItemListener(this); add(checkBox1); checkBox1.setVisible(false); } public void itemStateChanged(ItemEvent e) { repaint(); } public void paint(Graphics g) { String s1 = c.getSelectedItem(); if(s1 == "Primary Colors") { g.drawString("You have chosen:"+c.getSelectedItem(),100,100); g.setColor(Color.RED); g.drawRect(90,120,100,100); …

Member Avatar
Member Avatar
+0 forum 9

Alright Im new to this forum so lets hope this goes well, I have decided to learn Java and I started with the lwjgl, I have the exact class and code as posted here: [lwjgl (display)](http://www.lwjgl.org/wiki/index.php?title=LWJGL_Basics_1_(The_Display)) When I run the code I get an error message that says: `JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM` So, I did some research and found that if I add the code: `System.loadLibrary("jawt");` It might help, so I did, but java and my program both crash. I'm using mac osx, and I also read that you must have java 6 installed, …

Member Avatar
Member Avatar
+0 forum 1

I am finding it difficult to update the `JTable` when I enter a person's name in search button. The program compiles correctly without any errors, but in `SearchActionPerformed` event when the search button is pressed an empty table comes up. Where without search, the table is full of values from database. In the search criteria, I have typed a surname exactly as one from database but no returns. public class MainMenu extends javax.swing.JFrame { Academic ac = new Academic(); Connection conn = JavaConnect.ConnectDB(); PreparedStatement pst = null; String sql; ResultSet rs = null; ImageIcon format = null; public byte[] imagedata …

Member Avatar
Member Avatar
+0 forum 1

Ok so I am trying to build a little program and I want to be able to click on the skate or dice button and have the program open a new JFrame that has been built in another class. Currently it opens its own JFrame that was built in this method. I have the other classes built i have put the skate class below the main menu method. If someone could help me get this work I would greatly appreciate it. Another thing I tried is the getContentPane and that creates and exception in the thread Main method public class …

Member Avatar
Member Avatar
+0 forum 3

This is my assignment. I've done it 36 hours straight and I can't think properly so my program looks like kindergarden kid's program. Basically, we have to do a GUI for Pizza ordering. Everything works except for the amount. The output for amount is "0.00". I have to send it now to my lecturer but I just want to know where I am wrong. My lecturer won't tell me so I need help from you guys to tell me where I did wrong. Thank you. Earlier, I have problems with the arrays too but I solved it the long way. …

Member Avatar
Member Avatar
+0 forum 9

So I'm working on a small calculator applet and whenever a button is pressed (generating an action event) i get this: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException. Something about a missing source? The variable m is an instance of my myFunctions class which houses all the necessary formulas. I believe the problem lies in how the program is trying to access the class, but really have no idea how to remedy it. Here's my code: package Module1; import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; public class ScientificCalculator extends JFrame implements ActionListener { JTextField tfield; double a; char ch; JButton csc, …

Member Avatar
Member Avatar
+0 forum 5

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 thinking an arary of jlabels on a jframe? Anyone have any suggestions / ideas? thanks

Member Avatar
Member Avatar
+0 forum 3

I have a class which extends JFrame and this class is made singleton (private constructor, public static method to create instance if null). But still I get one more frame when already one is open. Can someone help?

Member Avatar
Member Avatar
+0 forum 9

I just started learning Java (Currently, I know basic swing components like JPanels, text areas, textfields etc) and I have chosen a Logic Circuit Simulator as a project. My objective is to simulate the working of logic gates by making circuits using drag & drop. So far, I have thought about putting the devices in a JList and then making a JPanel for the circuit area. The users will drag out of the JList and onto the JPanel where the circuit will be made. But I have no idea how to implement this in java. Please give me some directions …

Member Avatar
Member Avatar
+0 forum 4

Hmm i really like what applications like Windows Media Player and VLC player can do, and by this i mean: you know when you are watching a movie or listening to music and you minimize the window? Well if you hover the taskbar icon of the minized window with your mouse then you will see the 'preview' window show up... which normally is some far awya screen shot of the entire app, but with windows media player and vlc there are play and skip to next track or skip to previous track buttons. Soooo my question hw do we do …

Member Avatar
+0 forum 0

have various classes representing various types of program-genres (comedy, drama etc). I have a text file filled with '-' seperated values that get read by a class called Processing and puts them into a LinkedList. I have another class GUI_g that creates the GUI. It has 3 JTables. One for the list and 1 for each Channel. (Channel 1 and Channel 2). The JTable listTable gets filled from the linkedlist and whenever a user clicks on a row, the textfields' text changes accordingly. I tried with 3 fields (Title, Genre and Duration) and it worked, with the 3 textfields showing …

Member Avatar
Member Avatar
+0 forum 1

I have a GUI in which has a container for a JTable called 'listTable'. I want to populate the JTable with data stored in a linked list, using the AbstractTableModel. Basically, I have a LinkedList stored in Processing.java. It contains all the data retrieved from a text file. I created an AbstractTableModel to tell the JTable how to be populated. What I want to do now is to populate the JTable in GUI_g with "the contents of the linkedlist". Anyone can tell me how to do this? Here is the code: GUI_g: import java.awt.*; import javax.swing.*; import javax.swing.JTable; import java.util.List.*; …

Member Avatar
Member Avatar
+0 forum 1

Hello, I am creating simple an applet to draw a registration form based on the selected item within the awt choice object. I have include a radio button, choice list and button. My problem is when running the Applet...the choice list is blinking and when I maximized or minimise frame the component will be repeatedly to whole frame... Can someone please help explain how exactly to create a button, choice and radio button? Thanks :) [CODE] import java.awt.*; import java.awt.Font; import java.awt.Graphics; import java.awt.Choice; import java.awt.event.*; import java.applet.Applet; public class Student extends Applet implements ItemListener { public void paint(Graphics g) …

Member Avatar
Member Avatar
+0 forum 3

Hy , i read all the other posts about this error but didn`t helped me , tried google but notheing. I have the following method : [CODE] private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel)jTable2.getModel(); int nrrows = jTable2.getSelectedRowCount(); int[] rows = jTable2.getSelectedRows(); System.out.println("randuri selectate " +nrrows); int j,i; int col=0; Object value = new Object(); for(i=0;i<nrrows;i++){ value = model.getValueAt(rows[i] , col); System.out.print("randul"+rows[i]+" " ); System.out.print( value); System.out.println(" "); String connectionURL = "jdbc:mysql://localhost:3306/bazadedate"; Connection connection; try{ Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(connectionURL, "root", "123456"); PreparedStatement pst = connection.prepareStatement("DELETE FROM tabel WHERE id="+value); j = …

Member Avatar
Member Avatar
+0 forum 5

i googled for awt learnings then found a thread that awt is not necessary, you can directly go to swing. then i started swing, but i can't underdtand it that easily. now i know the very basic in swing, will you please help me to increase my accuracy by giving me some tips. or i have to learn awt first thank you!!

Member Avatar
Member Avatar
+0 forum 8

this is my java code that i'm experimenting with right now. trying to learn graphics. [CODE]import java.applet.*; import java.awt.*; public class game extends Applet { Image dbz; public void init() { Font newFont = new Font("TimesRoman", Font.BOLD + Font.ITALIC, 50); setFont(newFont); dbz = getImage(getCodeBase(), "dbz.jpeg"); } public void paint(Graphics g) { //Color red = new Color(255,0,0); //g.setColor(red); //g.drawString("hello world", 50, 50); g.drawImage(dbz,0,0,this); } }[/CODE] and i'm just using a regular html file to run it in. when i compile it i get no errors, but the image never shows. on line 12 i can type anything into the quotes and …

Member Avatar
Member Avatar
+0 forum 2

If you’re looking for low-cost GUI-test automation for Java, Qt, Mac OS X and Web applications, here’s a product you might find useful. Have you heard of Squish? It’s an automated function-testing tool from [URL=http://www.froglogic.com/pg?id=Home]Froglogic[/URL]. Released today was Squish 3.4, adding support for the May release of Trolltech’s [URL=http://trolltech.com/company/press-center/Qt4PressRoom]Qt 4.4 GUI framework[/URL], the June release of Eclipse 3.4 Ganymede, and for testing applications using varying GUI technologies from within a single test case. Also new in 3.4 is integration with [URL=http://ant.apache.org/]Apache’s Ant[/URL] build system and the [URL=http://cruisecontrol.sourceforge.net/]CruiseControl[/URL] framework for continuous build and integration process. Qt 4.4 now supports Qt, Java …

Member Avatar
+0 forum 0

The End.