32,199 Topics

Member Avatar for
Member Avatar for GeekTool

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){ …

Member Avatar for GeekTool
0
126
Member Avatar for GeekTool

> I have asked this question before, but i think i could not totally understand the diffefence between bitwise and logical operands. According to the book i am using to learn java, the bitwise operands can change the value and this is described as side effect. Also, in bitwise operands, …

Member Avatar for GeekTool
0
126
Member Avatar for soham.m17

I have a panel(JPanel) and it has FlowLayout by default. It has no preferredsize. I have a JScrollPane. So When I am adding buttons to the panel, the buttons are horizontally added. I want that to be added vertically. panel = new JPanel(); JButton clearButton = new JButton("CLEAR"); panel.add(button); JScrollPane …

Member Avatar for JamesCherrill
0
133
Member Avatar for Johannady2

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 …

Member Avatar for Johannady2
0
252
Member Avatar for Johannady2

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 …

Member Avatar for NormR1
0
2K
Member Avatar for Johannady2

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 …

Member Avatar for Johannady2
0
184
Member Avatar for Johannady2

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

Member Avatar for Johannady2
0
194
Member Avatar for sciwizeh

I'm working on a Graph based Image editor. My current plan is to have Nodes of the graph be operations on the image, an operation will take a number of input buffers and manipulate them in some way (be it invert a single input, composite two inputs, draw a rectangle …

Member Avatar for ~s.o.s~
0
171
Member Avatar for rajesh1158

In the below code, I want to know the significance of 10 while creating a PrioriyQueue. I know its the initial capacity but what does it mean?? I replace 10 with any positive number and the output remains same. import java.util.*; class Test { static class PQsort implements Comparator<Integer> { …

Member Avatar for JamesCherrill
0
199
Member Avatar for lilym

I am new to Regex... I need to split by "|&|" -- three characters in that exact order. For example, **"abc|&|e&f**" should return *"abc"* and *"e&f"*. I tried string.split("|&|") , but it return all single characters.

Member Avatar for NormR1
0
53
Member Avatar for MoMule

I wrote a class called Creature.java that creates a random creature object with various body stats. The Creature class extends MonsterGUI. I used Netbeans to create a new jFrame form, called MonsterGUI.java to create a GUI to display the creature objects' stats using jLabels. In MonsterGUI I have a private …

Member Avatar for MoMule
0
1K
Member Avatar for SuperManofBC

public void compareStrings() This method will prompt the user to type two strings and will put them into different String variables. Then it will compare those strings to see if they are the same, i.e. have the same letters in the same order. If the strings are the same, “same” …

Member Avatar for SuperManofBC
0
208
Member Avatar for Valiantangel

Just need some understanding on the various Prime number calculations.Please explain 1. verify by brute force that a number is evenly divisible only by 1 and itself.(dont implement the Sieve of Eratosthenes algorithm) 2. writing and running the program with upper limits of n/2 and the square root of n. …

Member Avatar for TrustyTony
0
120
Member Avatar for mehnihma

I am trying to cast vector to a string players = (Vector<Player>) inStream.readObject(); And I get error: java.lang.ClassCastException: java.util.Vector cannot be cast to java.lang.String Can someone tell me is there a way to do it? Thanks

Member Avatar for mehnihma
0
523
Member Avatar for warpstar

Hello, java noob here, in the code below, why is it when declaring a class that '<E>' is used in stead of the brackets ? '(E)'?? public class LLStack**<E>** implements Stack<E>{ private Node**<E> **head ; public LLStack ( ){ head = nul l ;} //creates an empty stack public boolean …

Member Avatar for anand01
0
106
Member Avatar for zina_a

hi, I have installed the IIS FTP server in my PC and I want to monitor this server with the SNMP protocol ,I have searched in mib files and I didn't found any information concerning this server,is there any other way to monitor a server programatecly and thanks.

0
83
Member Avatar for peter_budo

Simple code to see if array of primitives has duplicates. The aim is to only check if there are any duplicates, but not to check what element is repeated, or its position etc. PS: Do you know some handy snippet? Don't way, post it!

Member Avatar for odoepner
4
953
Member Avatar for sciwizeh

So this is mainly a Design/Clean Coding sort of question, I know I've read something about this previously but I can't find it, I believe it's in one of my reference books on C/C++ so it wouldn't likely be useful to my predicament. This question includes a lot of Java …

Member Avatar for sciwizeh
0
247
Member Avatar for speakon

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 …

Member Avatar for speakon
0
369
Member Avatar for libathos

I was wondering how is it possible to receive a "key-pressed" event in Java even when my program is in background.

Member Avatar for Majestics
0
64
Member Avatar for ocw91

i having trouble adding the JSeparator into GUI. It just won't come out =( i write it like this, but nothing happen... JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL); pane.add(separator);

Member Avatar for NormR1
0
70
Member Avatar for natri1991

Everyone watch my code and help me. I'm building a simple program like Paint the windows. Here, I just do the free drawing button. But when I press the button and draw freehand drawing, then the panel draw the toolbar to copy the image above and press a button every …

Member Avatar for NormR1
0
420
Member Avatar for TIM_M_91

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 …

Member Avatar for wen_cai
0
99
Member Avatar for koolhawk

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")); …

Member Avatar for NormR1
0
210
Member Avatar for cocofly123

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 …

Member Avatar for TrustyTony
0
269
Member Avatar for yuyuttiu

Hi, I'm new to this site, and I thought this place might help me with some of the problems I am hitting. I am currently in grade 12 Computer Science, and I am coding a third-dimensional snake game (isometric view, so can all be drawn in 2D) I have taken …

Member Avatar for yuyuttiu
0
649
Member Avatar for TIM_M_91

Ok so when I run the following code nothing occurs so could someone look at the code and tell me where I have gone wrong? public class somee { public static void main(String[] args) { somee f = new somee(); } public void f() { int anInt = g(7); System.out.println("ffff"+anInt); …

Member Avatar for JamesCherrill
0
183
Member Avatar for vinnitro

This is my program import java.util.*; class Triangle { public static void main(String Vinod[]) { int i,j,n; Scanner sc=new Scanner(System.in); System.out.print("Enter a height of triangle : "); n=sc.nextInt(); for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { System.out.print("*"); } System.out.println(); } for(j=n;j<=1;j--) { for(i=j;i<=1;i--) { System.out.print("*"); } System.out.println(); } } } I dont know what …

Member Avatar for vinnitro
0
156
Member Avatar for ishlux

Hi all, i have installed jdk1.7 , now i want to set the class path.. because i am compiling my program its giving an error.....javac is not recognized as an internal or external commond. please help me to set the class path.......and how to able to run my program.

Member Avatar for ramguru
0
94
Member Avatar for soledad82
Member Avatar for ramguru
0
139

The End.