Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
2
Posts with Upvotes
2
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
3 Endorsements
Ranked #486
~15.2K People Reached
Favorite Forums
Favorite Tags
java x 49
key x 3
Member Avatar for javaprog200

Hello Members, I have a basic java question about non-terminating float values: public class FloatandDouble { public static void main(String args[]){ float a = 1.0f/3.0f; System.out.println (a); System.out.println (b); } } The output of the program is 0.33333334. Why is it not 0.33333333? Thank you

Member Avatar for javaprog200
0
178
Member Avatar for javaprog200

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 …

Member Avatar for JamesCherrill
0
280
Member Avatar for javaprog200

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.*; …

Member Avatar for franko1990
0
4K
Member Avatar for javaprog200

Hello, I am trying to display text(JLabel) above a 3 x3 tic tac toe grid. The JLabel is not displayed. Only the grid shows up. I would be grateful for any help. Thank you! import java.awt.*; import javax.swing.*; import java.applet.Applet; public class Game extends JApplet { LayoutManager layout; private JPanel …

Member Avatar for javaprog200
0
325
Member Avatar for javaprog200

Hello, I am trying to learn how to use the JGrapht API and a sample program on the web has the following line on how to create a SimpleGraph: SimpleGraph graph = new SimpleGraph<String, DefaultEdge>(DefaultEdge.class); The above line is clear execpt for the "DefaultEdge.class" in the parenthesis. What's the significance …

Member Avatar for M4trixSh4d0w
0
112
Member Avatar for javaprog200

Hello, As per wikipedia, a complete binary search tree is defined as: A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible Can someone give me an application of complete binary trees …

Member Avatar for javaprog200
0
290
Member Avatar for javaprog200

Hello, I am trying to understand what a byte array is. public class ByteArrayExample { public static void main (String args[]) { byte[] array = "1".getBytes(); System.out.println (array); } } The output of this program is : [B@44770739 Is this a hexadecimal representation? If any of the members can explain …

Member Avatar for javaprog200
0
216
Member Avatar for javaprog200

Hello, I have a class (Buttons.java) which inherits from JButton and implements the ActionListener interface. The second file (ButtonsTest.java) creates a GridLayout of Buttons and adds them to the applet. The issue I am having is when I click on any of these buttons, the event is not registered. I …

Member Avatar for JamesCherrill
0
265
Member Avatar for jprog1000

Hello Members, I have a program (from Deitel Java Solution Manual) which bounces a ball using a Java thread inside a JPanel(which is inside a JFrame). When I made a custom class for the ball, the program is not painting anything on the JPanel.I would appreciate any help. Following are …

Member Avatar for javaprog200
0
327
Member Avatar for javaprog200

Hello, I am writing a Java applet which uses the JExcel API to write to an Excel file. I have pasted the run-time error that I get below. After some research about the Exception, I added a policy entry using the policytool command for any Java program by selecting CodeBase<ALL>. …

Member Avatar for javaprog200
0
623
Member Avatar for javaprog200

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 …

Member Avatar for javaprog200
0
249
Member Avatar for javaprog200

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 …

Member Avatar for javaprog200
1
141
Member Avatar for javaprog200

Hello, Are any of the older exams for the Sun Certified Java Programmer certification available online? I was able to find mock exams and other test prep material. Just wondering if earlier exams are available. Thank you!

Member Avatar for rotten69
0
171
Member Avatar for javaprog200

Hello, The following program computes the value of Pi using the Hit/Miss method. Since I am doing all the drawing in the JPanel, I am not calling super.paintComponent(g). The program works well, but since I am not using the super.paintComponent, it does not draw the background. Is there any way …

Member Avatar for javaprog200
0
396
Member Avatar for javaprog200

Hello, The following program displays two images (ImageIcon type) inside the JTextArea. Is there a way I can make both of these images transparent sothat what I type on them is visible? Thanks in advance! import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import java.io.IOException; public …

Member Avatar for JamesCherrill
0
202
Member Avatar for javaprog200

Hello, The following program has a JFrame which contains an image, JTextArea and and a textfield. How can I display the image inside the text area? I will be grateful for any help! Thank you! import javax.swing.*; import java.awt.*; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.awt.event.*; public …

Member Avatar for DavidKroukamp
0
5K
Member Avatar for javaprog200

Hello, I am working with the AudioClip class. It has methods for playing, stopping and looping an audio file (.wav/.au). Is there a way I can check when an audio file has completed playing? The stop() method is void. Is there any other class I can use? Thank you!

Member Avatar for javaprog200
0
84
Member Avatar for javaprog200

Hello, The following is a bouncing ball applet. When I do double buffering (variables, g1 and image), I still see the flickering . I would be grateful for any help. [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.lang.Thread; public class Ball_Bounce extends JApplet implements Runnable { private Thread blueBall, redBall; …

Member Avatar for javaprog200
0
199
Member Avatar for javaprog200

Hello, The following applet displays two .jpg files (ImageIcon objects - x and y) on a JPanel. I would like to display the second ImageIcon object (y) as transparent. Is that possible? Thank you! [CODE] import javax.swing.*; import java.awt.*; public class PicPanel extends JApplet { ImageIcon x, y; JPanel panel; …

Member Avatar for javaprog200
0
2K
Member Avatar for javaprog200

Hello, When I run the following program, the applet window displays nothing. I will be grateful for any help. [CODE] import javax.swing.*; import java.awt.*; public class BoxPanel extends JPanel { private JTextField label1, label2; public BoxPanel() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); label1 = new JTextField(20); label2 = new JTextField(20); add(label1); add(label2); …

Member Avatar for NormR1
0
139
Member Avatar for javaprog200

Hello, The following program has three JPanels - one to hold the image, one for the JComboBox and the last one for holding the JLabel, JTextArea and JButton. Once a selection is made in the JComboBox, the user will enter text in the textarea and press the button. The button …

Member Avatar for javaprog200
0
245
Member Avatar for javaprog200

Hello, The following program displays the text area for the entire JFrame even though I have set the dimensions of the text area to be 10 x 15. Any help will be greatly appreciated. Thank you! [CODE]import javax.swing.*; import java.awt.*; public class Scrollers extends JFrame { JTextArea area; JButton button; …

Member Avatar for javaprog200
0
180