32,199 Topics

Member Avatar for
Member Avatar for mrkm1188

Is there a way to improve the below Selection Sort code to make it more efficient? [ICODE] int a, b, smallest, temp; for(a = 0; a < numIntegers - 1; a++) { smallest = a;; numComp++; for(b = a+1; b < numIntegers; b++) { if(Integer.parseInt(list[b].toString()) < Integer.parseInt(list[smallest].toString())) { smallest = …

Member Avatar for mrkm1188
0
152
Member Avatar for grako84

Hi folks! I'm trying to wire simple code and so far I'm stuck on ActionListener. My program should contain (JMenu) Menu called SELECT and two options InnerFrame 1 and InnerFrame 2. To debug it I've started using System.EXIT , unfortunately I cant compile my program, I'm receiving an error: "java:48: …

0
121
Member Avatar for dennysimon

hi all, Is there simple example out there where image is made by drawing lines on the panel ,and then print it on paper thank you denny

Member Avatar for dennysimon
0
124
Member Avatar for Daigan

Here's what I have so far.. [CODE] // The "AddingPrefixes" class. import hsa.*; import javax.swing.JOptionPane; public class AddingPrefixes { static Console c; // The output console static char proc; static String prefix; static String word; static String sentences; private void title () { c.print (' ', 32); c.println ("Adding a …

Member Avatar for NormR1
0
177
Member Avatar for sha11e

When reading or writing to files, what should you have in a try-catch? And should you have a finally? Should I have everything in the try? Like.. maybe create a File variable to check if a file with that name exists etc and throw errors if they do. And then …

Member Avatar for sha11e
0
141
Member Avatar for jazz_vill

I have a Java Desktop Application I made and I am now on the process of deploying the application. I tried to use Java Web Start but came up with certain problems. My application is fully working when I start it locally or inside my IDE. But when I try …

0
134
Member Avatar for pxndx

Ok so i have a little problem which i cant seem to figure out this is what i have: The constructor loads my method that loads a list of employee to show in jTable, but when i place that method in my button it doesn't do anything This is my …

Member Avatar for jazz_vill
0
157
Member Avatar for javabeginner1

Can somebody please help me figure out where I went wrong? This is the problem and I have attached my code. Write a class with a main() method and two static methods. Your program should prompt the user for a single-digit integer. Your program should print out to the screen …

Member Avatar for javabeginner1
0
225
Member Avatar for th3b3n

First the gui question Right now I have: [CODE]class ExportGUI extends JFrame implements ActionListener{ JTextField fileIN; //Text Field Bull //JLabel fInHelp;//Labels time JFileChooser BpsFile = new JFileChooser(); //File Chooser JCheckBox Check; JButton expButton; //reference button object JButton opnButton; JButton reset; JButton all; //Panels List<JCheckBox> checkList = new ArrayList<JCheckBox>(); JPanel inOut …

Member Avatar for stultuske
0
233
Member Avatar for mohamed moamen

I'm create a program using java and MySql (jdbc) my problem where I'm start up the program in my customer computer , i must set up MySql program or not

Member Avatar for jwenting
0
142
Member Avatar for innspiron

Hello anyone, I have code: [CODE]java.lang.System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); SSLContext ctx; ctx = SSLContext.getInstance("TLS"); ctx.init(new KeyManager[0],new TrustManager[] { new DefaultTrustManager() }, new SecureRandom()); SSLContext.setDefault(ctx); Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); URL url = new URL("https...."); HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); DataOutputStream output = new DataOutputStream( conn.getOutputStream()); output.writeBytes("data"); output.flush(); output.close();[/CODE] How do I edit …

0
73
Member Avatar for rievan

Hello I am having issues with a script.. I am trying to have an array carry a bunch of vimeo codes. What I want to do is make it so that when someone clicks a button created by the array they are able to see a vimeo script open in …

0
80
Member Avatar for Unsated

Working on a simple banking program and it doesn't compile. Worked perfectly when everything was in main, then i was told to divide into methods( where everything went wrong ). The errors im getting are: C:\Users\DJ3\Desktop\School\Minilab5.java:30: illegal start of expression } ^ C:\Users\DJ3\Desktop\School\Minilab5.java:67: illegal start of type switch (userChoice) ^ …

Member Avatar for Unsated
0
420
Member Avatar for TehCPP

Hello everyone, i thought of this question and i would greatly appreciate some pointers on it. I have 2 simple Java Projects which are GUI based. One writes some information to a text file. The other reads the text field and displays it on the GUI. My question: Is it …

Member Avatar for TehCPP
0
164
Member Avatar for poojavb

Hello Friends, I need a hint to auto complete the combobox. I have two table SpeciesMaster and BreedMaster (Access Database) In the java code on the action Listener of the Species combo Box the breed details gets populated in the breed combobox. But now I want to filter the breed …

Member Avatar for poojavb
0
1K
Member Avatar for libathos

Is there any way that i can create a gui which contains an excel diagram sheet?not a jtable..

Member Avatar for peter_budo
0
98
Member Avatar for mmxvoid

[CODE]import java.util.Scanner; public class Sales { private String salespersonName; public Sales( String name ) { salespersonName = name; } public void setSalesPersonName( String name ) { salespersonName = name; } public String getSalesPersonName() { return salespersonName; } public void displayMessage() { System.out.printf( "Welcome to the sales calculator for\n%s\n\n", getSalesPersonName() ); …

Member Avatar for mmxvoid
0
211
Member Avatar for Daigan

[CODE]// The "StringReplacement" class. import java.awt.*; import hsa.Console; public class StringReplacement { static Console c; // The output console public static void main (String[] args) { c = new Console (); String word; String word2; String sentences; int i; c.print ("Enter the word to be replaced: "); word = c.readLine …

Member Avatar for Daigan
0
181
Member Avatar for glut

Hey, DW. I really need to know how to combine two images, into one image, but I don't want to draw it to the screen, and I don't want to save it to a file. It should look something like this [CODE] Image img1 = new ImageIcon("C:\\flying.png").getImage(); Image img2 = …

Member Avatar for glut
0
1K
Member Avatar for mrar85

Write a program that launches 100 threads. [COLOR="Red"]Each thread adds 1 to a variable sum that initially zero. You need to pass sum by reference to each thread. In order to pass it by reference, define an integer wrapper object to hold sum[/COLOR]. Run the program with and without synchronization …

Member Avatar for mrar85
0
2K
Member Avatar for matharoo

I am trying to store the numbers of a text file into a 2D array.. Here's the text file: 1 2 3 2 3 4 4 5 6 But i get the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at BankerAlg.main(BankerAlg.java:30) Process completed. Here's the code i made: [CODE] import …

Member Avatar for matharoo
0
2K
Member Avatar for slasherpunk

I have created a window containing only one button(park1). All I need is a new dialog(with "OK" and "Cancel" buttons to open when I click on park1. Thanks in advance. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; class MyWin extends JFrame implements ActionListener { JButton park1; MyWin() { setSize(450, 500); …

Member Avatar for mKorbel
0
3K
Member Avatar for ragira

new in programming and really need your help to code interfaces of applications using j2se

Member Avatar for JamesCherrill
0
35
Member Avatar for vaironl

Hello forum, Vaironl here. I believe this questions has been answered before, but I cannot find the answer.. weird. I have a class which is called panel and extends a JPanel and a paint method. For some reason my Jlabel is not appearing, I read common painting problems, and tried …

Member Avatar for mKorbel
0
2K
Member Avatar for javaNewb37

I want to modify the below code to read the Polynomial Terms from a text file (vs. hard-coded values) Furthermore, read data from text file in the format: P1 = 3 5 1 -1 0 8 P2 = 5 6 2 -1 1 7 0 -4 etc... Name the values …

Member Avatar for stultuske
0
335
Member Avatar for Mike Tyson

I am having trouble completing This hangman project. It mmost be done using model view controller pattern. Here is what i have so far //Header file declarations import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileInputStream; import java.io.IOException; import java.util.Scanner; //Class declaration class HangmanModel extends JFrame implements ActionListener { …

Member Avatar for stultuske
0
258
Member Avatar for Bobonoinc

I am working on an application in which I select a color from a color selection dialog and click on a graphic shape to change its color. Everything is working fine, but now I would like to change the default arrow-shaped cursor to an eyedropper shape when I am in …

Member Avatar for Bobonoinc
0
95
Member Avatar for jhellr13

Hey I'm in an AP Computer Science class working on classes. We have been working on a project that is a date class that does certain things like setYear, getMonth, getDay, etc. I have gotten all of those to work, except for one. The last one is a boolean method …

Member Avatar for stultuske
0
300
Member Avatar for frank33

My Java instructor yesterday gave us a sample test. One line that surprised me was something like [B] if ( m2++ < 10 ) { ………[/B] iow the first thing done is , in effect m2 = m2 + 1, an ASSIGNMENT. Whether the instructor ever actually discussed this in …

Member Avatar for stultuske
0
138
Member Avatar for evilweevil

[B]hey guys: i put a question 2 days ago after having a problem with this equation and u guys helped me alot and solved it but i want to program it in java everything went well but gave me 2 errors here is the code and all information the code …

Member Avatar for stultuske
0
2K

The End.