388 Posted Topics
Re: [CODE] final JComboBox list = new JComboBox(); final JTextArea jtxt1 = new JTextArea(); final JTextArea jtxt2 = new JTextArea(); final JLabel jlab = new JLabel(); final StringArrays sa = new StringArrays(); final DefaultComboBoxModel model = new DefaultComboBoxModel(new String[]{"Cortina", "Fiesta"}); list.setModel(model); //by default fill fields (idx=0) sa.fillFields(0, jtxt1, jtxt2); list.addActionListener(new ActionListener(){ … | |
Re: Answer my question, if the mouse stops moving, text disappears? if yes, you need use paintComponent method | |
Re: Line21: in your case each time listItems.length==1. then declare int listItems[] outside for-loop(line18), with size=10, use for-loop i-index for fill listItems[i] end of this loop before line24 | |
| |
Re: Start this as an applet [CODE] package checkers1; import java.awt.Graphics; import javax.swing.JApplet; public class Check extends JApplet { private Checkers1 ck; @Override public void init() { super.init(); ck = new Checkers1(); } @Override public void paint(Graphics g) { super.paint(g); ck.draw(g); } }[/CODE] | |
Re: [CODE] private void loadImage() { cardImage = new ImageIcon(getClass().getResource("cards.png")).getImage(); }[/CODE] hand was null! [CODE] public CardPanel() { hand = new CardSet(); loadImage(); setPreferredSize(new Dimension(15 + 4 * (15 + 79), 185)); }[/CODE] cardSet was null! [CODE] public CardSet() { cardSet = new Card[4]; Random r = new Random(); cardSet[0] = … | |
| |
Re: follow this example, first [CODE] public static void main(String[] args) { int arr[][] = {{5, 9, 6}, {3, 2, 8}, {7, 0, 1}}; for (int row = 0; row < arr.length; row++) { for (int col = 0; col < arr[row].length; col++) { System.out.println("arr[" + row + "][" + col … | |
Re: from my resources [CODE] public void deleteData() { int rows = getRowCount(); if (rows == 0) { return; } cache.clear(); fireTableRowsDeleted(0, rows - 1); }[/CODE] | |
Re: Developing Games in Java - David Brackeen [URL="http://www.brackeen.com/javagamebook/"]http://www.brackeen.com/javagamebook/[/URL] | |
Re: You can format desc in HTML style using HTML tags. Also you can use ToolTipText in same style. [CODE=java] txt.setText(desc[index]); combo.setToolTipText(desc[index]);[/CODE] | |
Re: Result of split method is an array from java doc: [CODE=java]public String[] split(String regex)[/CODE] | |
Re: [URL="http://65.110.21.43/jgloss/utf.html#WRITEUTF"]http://65.110.21.43/jgloss/utf.html#WRITEUTF[/URL] Use first lines -->public final class UTF8 --> of method --> private static void testWriteUTF(). File.createTempFile( used as bridge. /** * Discover how Java's use of UTF-8 conforms with Unicode standards. * <p/> * composed with IntelliJ IDEA * * @author Roedy Green, Canadian Mind Products * @version 1.0, … | |
Re: [CODE=java]public DDMainMenu() { initComponents(); ddPane.setEnabled(false); searchPane.setViewportView(new DDLoginInterface(this));//TODO }[/CODE] [CODE=java]public DDLoginInterface(DDMainMenu mainMenu) {//TODO this.mainMenu = mainMenu;//TODO initComponents(); }[/CODE] [CODE=java]... } else if (ddl.loggin(usernameF.getText(), passwordF.getText())) { JOptionPane.showMessageDialog(null, "You have logged in sucessfully"); mainMenu.forceViewportView();//TODO System.out.println("hello actionPerformed 4"); } else { ...[/CODE] [CODE=java]void forceViewportView() { searchPane.setViewportView(new DDSearchInterface()); ddPane.setEnabled(true); }[/CODE] inconsistencies in method getPanel() - … | |
Re: Local varible tf (line 25) hides a field tf (line 8) Same with textArea declaration. Errors are for programmer to read carefully. | |
Re: add ActionListener to jcbBankName inside ActionPerformed method: - check jcbBankName.getSelectedItem() - force new model - jcbBranchName.setModel(...your model..relate to checked value) in the constructor of your class, do not forget to set default values for both the comboboxes | |
Re: First part of code: In method (line 1) locally declared trainerList-varible is only visible inside this method. Second part of code: Method in line 1 method createArrayList() should return [I]return new ArrayList<PokemonTrainer>();[/I] // Show your static fields, and original compiler messages | |
Re: Here is not present inner class! Why inner? You need class Person with fields: name, sales, expenses with proper constructor and get...() methods. also List<Person> personList = new ArrayList<Person>(); 1. operate with it to succesive store readed i formed new instances of person data, 2. at end - make all … | |
Re: Each time is created a new instance of PrintStream out -line 129 You need create this instance only once (without this method, and put it as an additional method parameter). | |
Re: hello allang [icode] Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: 15 [/icode] i have same error , but i have no images. You must have html file and images folder in same place. Name of images folder is "images". Inside image folder You must have image files with names: IMG1.bmp,IMG2.bmp,...,IMG15.bmp Try... Also … | |
Re: hello sandawg [code=java] public class Inventory2 { static class Group { private int currentIndex = 0; private Element[] elements; Group(int itemsTotal) { elements = new Element[itemsTotal]; } void add(Element el) { elements[currentIndex] = el; currentIndex++; } double getValueOfTotalInventory() { double sum = 0; for (int i = 0; i < … | |
Re: PageFormat.LANDSCAPE ? check Class PrinterJob , method pageDialog(PageFormat page) : displays page set up dialog. your width=212.25 height=141.5 | |
Re: You should know the classes and their methods: java.lang.Integer java.lang.String for example: java.lang.String st = java.lang.Integer.toString(x); | |
Re: [CODE=java]public static void main(String[] args){ new Pay(); }[/CODE] Implement constructor Pay(). From constructor invoke computeNetPay - method. | |
![]() | Re: 1.In constructor create a new Instance of ArrayList class [B]inventory = new ArrayList<ItemID>();[/B] 2. > j.addItem(ROPE) --> look at line 15 of your Player class |
Re: In class Main implement MouseMotionListener interface Check, where mouse is inside the Rectangle(50, 90, 40, 40) Make button visible depending on this value | |
Re: Try of use [I]revalidate(), invalidate(), repaint()[/I] and other similar methods clearly indicate a EDT problem (Event Dispatch Thread) read and follow the given solutions: [URL="http://mindprod.com/jgloss/swingthreads.html"]http://mindprod.com/jgloss/swingthreads.html[/URL] | |
Re: [QUOTE]Formatted printing for the Java language is heavily inspired by C's printf.[/QUOTE] [URL="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html"]http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html[/URL] [URL="http://java.sun.com/developer/technicalArticles/Programming/sprintf/"]http://java.sun.com/developer/technicalArticles/Programming/sprintf/[/URL] | |
Re: Remove lines L2,L3,L4. You can use them inside program before invoke the [I]getInvoiceAmuont[/I] method. | |
Re: use javax.swing.JOptionPane [URL="http://www.java2s.com/Tutorial/Java/0240__Swing/InputPopUps.htm"]http://www.java2s.com/Tutorial/Java/0240__Swing/InputPopUps.htm[/URL] | |
Re: [URL="http://www.visualgenomics.ca/xdong/work/vrco/software/include/j3dBundlePackages.zip"]http://www.visualgenomics.ca/xdong/work/vrco/software/include/j3dBundlePackages.zip[/URL] | |
Re: Proper place for lines L228-L242 is [B]public boolean action(Event evt,Object obj)[/B] method | |
Re: L34 add to check: [CODE]System.out.println(array[r][c]);[/CODE] L30 fill array | |
Re: int counter = 0; This varible need to be declared before while-loop L:18 | |
Re: What does mean the keyword [B]implements[/B] PriorityQueue for PriorityQueueLinked class? | |
Re: There is no significant difference what we seek. Post your "Integer" code | |
Re: Feel the difference between the element of the set, and a set of elements [CODE=java] for (String inner : list1) { System.out.println("pushed " + istak.push(inner)); }[/CODE] | |
Re: As for me, "the water is too deep" HowToWriteYourOwnCompiler using tools freely available on the Internet [URL="http://staff.polito.it/silvano.rivoira/HowToWriteYourOwnCompiler.htm"]http://staff.polito.it/silvano.rivoira/HowToWriteYourOwnCompiler.htm[/URL] | |
Re: L15 L39 double declared startingField, the second declaration covers previous L82 looking for L15 you have more than one such case | |
Re: seats[i] = new JButton(String.valueOf(i + 1)); seats[i].addActionListener(this); public void actionPerformed(ActionEvent ae){ String text = ((JButton) e.getSource()).getText(); //.. } you don't need loop inside actionPerformed method | |
| |
Re: L10: absence (), public Connect4Model(){ L12: indicates the static method --> static void reset(){ | |
Re: ControlPanel, method actionPerformed, event "resetButton" (NEW GAME) in place reset() method - create new instance of Connect4Model with current values from text-fields and force changes in DrawPanel class. [CODE=java] model = new Connect4Model(Integer.parseInt(numCols, Integer.parseInt(numRows.getText())); canvas.setModel(model);[/CODE] write method setModel in class DrawPanel | |
Re: make most external for-loop // if ((true == lottoNbrList.isEmpty())) True is always true if ((lottoNbrList.isEmpty())) Means same // In this case you can bypass the check lottoNbrList1.isEmpty() L20-29 new form [CODE=java] if (!lottoNbrList.contains(j)) { lottoNbrList.add(j); itemAdded += 1; }[/CODE] | |
Re: 1. Convert get = new Convert(); 2. GetAction send = new GetAction(); ad1.delete ad2 place in constructor with and change to: send = new GetAction(this); (some little changes are needed) | |
Re: package org.apache.pdfbox; public class TextToPDF [URL="http://pdfbox.apache.org/download.html"]http://pdfbox.apache.org/download.html[/URL] to see, where newlines "goes". | |
Re: Class EightPuzzleDemo is only an example of use. Make all what you need. |
The End.