I have the following code. how can items be added to that list?
private List<IComponentNode> comp;
interface IAAAView {
// returns component with given code or null
IComponentNode findComp(String a);
// returns component with given renderer or null
I'm having trouble completing my homework. The problem:
>Suppose that you want an operation for the ADT list that adds an array of items to the end of the list. The header of the method could be as follows: public void addAll(T[] items)
>Write an implementation of this method for the class LinearLinkedList
At first this seemed like an easy problem to me. This is the solution I came up with:
public void addAll(T[] items) { int length = items.length; for(int i = 0 ; i < length; i++){ this.addLast(items[index]); } }
However, one of the requirements for the assignment is that we're not allowed to use the addLast method. how else to insert items to the Linked List without this method. These are the user-defined LinearLinkedList and ListNode classes we made during class:
**LinearLinkedList** // Linear linked list class import java.util.NoSuchElementException; public class LinearLinkedList {
I want to create a program which contains a list with 5 items and a button on the first display. The desired option is chosen from from the list and the button is pressed. On pressing the button it must open a new form which corresponds to the chosen item from the list.
I am trying to create a GUI interface in swing which consists of four classes: a GUI class, which creates a main JPanel, a label, and a JList, which it takes from the second class, a MovesList class that contains a JList and the stuff needed to interface with it. It also has a main class, which basically just creates an object of the GUI class for the main window, and an Other class from which I would like to be able to add an item to the JList. I created methods in the MovesList class to get each component (like getMoveslist, or getMovesListScrollPane), which I then used to create the JList in the GUI class. I also created an addMove method so that I can add an item to the JList from any class through a MovesList object. However, this addMove method only works when called from the GUI or MovesList classes -- it does nothing when I collect from the Other class.
Here is my code:
//Main class public class TestProject { public static void main(String[] args) { GUI mainWindow = new GUI(); mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
[Code] ....
When I run this code, I get a window with a JLabel that says "Moves," and a JList that contains five elements -- test 1-test 5, but not a sixth "test from other class." ( using the add move method ) However, when I click on the window, the addMove method is also called, and successfully adds "test 6" to the list.
I am creating a .jar for a game I made. I'm not using any dev tools, just a DOS console call to java: %~dp0....javajdkinjar.exe -cfmv TheSwarm.jar manifest.txt *
My manifext.txt contains:
Main-Class: Game
But when I compile the jar, its manifest contains:
And I get an error about it not finding the main class. Shouldn't my Main-Class setting be added to the jar? I can manually rename it to .zip and edit the Manifest.MF but that is a huge pain when I'm testing the .jar file and regenerating it often.
I am trying to create a form where my customer can add some other fields(like: label,textbox), and he need to use that added fields for the next time he open the application...
I would like to know whether it is possible to save dynamically created controls and reuse it again...
I have a ace:dataTable which contains a variable number of columns. For this I use the c:forEach tag. All generated in the c:forEach are not displayed. In the sample, only columnLibelle and columnSum are displayed.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
I'm just a java beginner. I've spent a lot of time installing and configuring software. I'm using Netbeans 7.3 on Windows 7, 64 bit. Recently, I downloaded opencsv from sourceforge.
With no previous experience adding libraries, I read a blog post on adding the library. I think that I then:
Start a new project.
Right click on libraries
Add jar/folder
Gave the temporary path to the .jar file
After, I read the blog post again, and realized I'd missed it. This time I did:
Right click library, Add library, Create library
However, I kept getting a message that the same library already existed. If I do the first process above, I will find the same library.
However, I see no way in Netbeans to remove it. I've deleted the test projects. And started a new one. But the library now exists for all projects it seems.
I've grepped all the files under the Netbean directory, searching for "opencsv", but found nothing. The only things in the Windows registry were locations of files.
How can I delete this library permanently from Netbeans? Short of, uninstall, then reinstall? Is there a way to list all the libraries that Netbeans has?
Here is my full program, you can find these lines of code on lines 64 and 70.
Java Code:
import java.util.Scanner; public class StockTransaction { public static void main(String[] args) { // TODO Auto-generated method stub //Variable Declaration Section
My panel named panelIncomeInfo are not showing the components that I have added.
public class PayrollGUI { private JPanel panelIncomeInfo = new JPanel (); private JPanel panel = new JPanel (); private JPanel panelPayCheckInfo = new JPanel (); private JButton close = new JButton ("Close");
The following alert returns an added string instead of adding the var together to give me a total?
var tvHours = prompt('How many hours of Tv do you watch last week?'); var webHours = prompt('How many hours of internet surfing did you do last week?'); var gameHours = prompt('How many hours of video games did you play last week?'); alert(tvHours + webHours + gameHours);
Also can you store a var in an alert? e.g ( var time = alert(tvHours + webHours + gameHours); ???
I have a .jar that is installed in other computer(outside netbeans). Everything works fine except with report. I am sure the libraries needed for iReport is added in my lib folder but I receive this error message when I to load the report using the program.I use command prompt to see the error:
Java Code:
java -jar projCosting.jar mh_sh_highlight_all('java'); And here is the error message: Java Code: net.sf.jasperreports.engine.JRException: Error compiling report java source files : [b]D:CostingRptCosting_1288072391310_955208.java[/b] at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses
[code]....
I have included the library in lib folder but do you think I have to install the iReport application?
I am adding JLabels to my JPanel, and the last one always does not show up. For example if I add 3 JLabels, the 3rd will not show up. If i change it to add 4, the 4th will not show up, but the 3rd will now. Here is a snipit of what my code looks like:
A workaround that I DO NOT want to keep doing is to put an extra fake JLabel at the end of the for loop, that way everything I want to show up does, but the fake one does not.
I have been playing around all day trying to get this to increase the value of number by one after each new runner is added. How to get the value of number to increase after each record is added?
public class Runner { /* static variables */ /* instance variables */ private int number; // runner's number private String name; // runner's name private String ageGroup; // standard, junior or senior private int time; // runner's marathon time in minutes
On jsp page i have created table with dynamically added rows now i want to insert the data from dynamic row field into database. How would I get the ids of those dynamically created rows to insert into database using hibernate.
I am new to java and during my classes we built a basic calculator. I want to extend my calculator and added function to square numbers.Here is my program:
In the code below, under calculations, I have x=totalPrice+xXxXxX. Obviously the x's were just place holders, but I wanted to know if there was any way to add something there so the program would tally the totalPrice, store it in the x variable outside the loop, so when the loop ended it would display the total price from all the loops added together where I have System.out.println("TOTAL OF ALL ORDERS: $"+ round.format(x)); at the very end.
Java Code:
import java.util.Scanner; import java.text.DecimalFormat; public class ModifyOrderV2TEST { public static void main(String [] args) { //Rounding DecimalFormat round = new DecimalFormat("0.00");
I'm trying to develop a system for test cases so that whenever a test case is added to a particular package it will automatically be included in testing without having to manually add that particular test case. What is the best way to achieve this? Should I use java reflection? I'm just getting started with Jenkins and trying to configure Selenium test cases.
I am unable to clear disappear the background of .png image added in a translucent JPanel. I have tried it using JLabel but the image added is with white background. How can i get rid of this white background...
import javax.swing.*; import java.util.*; import java.awt.*; public class HomePage { JFrame frame; JPanel pnl1, pnl2, pnl3; JLabel lbl;
I try to create a jsf project within ejb which is add new car with entering attributes listing attributes and search by make.
Add and list methods working well , but have problem of list method. I tryed many combinations (using enhanced loop, iterative loop) but i cant provide working well. Always outputText returns nothing ,when i enter attributes.
Here is ejb code for adding ,getting and listing car items :
@Stateful public class CarsBusiness implements CarsBusinessLocal { List<Car> cars; public CarsBusiness() { cars = new ArrayList<Car>();
I facing issue with nested <c:forEach in my jsp page.I am using jstl.jar..Here is my code
in JAVA I have --> List<ProductDefViewBean> productList = new ArrayList<ProductDefViewBean>(); productList.add(objProductDefViewBean); request.setAttribute("ProductList", productList); <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
[code]...
javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>
I made my items class and I am storing my item as a String array to list them all and what I want to be able to do is type pickup, have the game read my location and display the items that are avaible to pickup at current location then type the item and store it in my playerInventory. Then, have it check the slot if it is doesn't equal null go to next.
Use a boolean value of 0 = false and 1 = true. then, have it check if the inv array = 1 or 0. if 1 go to next inv. If all are full then, ask player if they would like to replace an item. Use a 2d array for storage for slots and true or false value.
Here is my code
Player.java package com.PenguinGaming; import java.util.Random; import java.util.Scanner; public class Player { public void User(){ Commands commands = new Commands(); Map map = new Map();
I have a JPanel that's using a simple GridBagLayout.
JPanel panel = new JPanel(); GridBagLayout qPanelLayout = new GridBagLayout(); qPanelLayout.columnWidths = new int[] { 0 }; qPanelLayout.rowHeights = new int[] { 0 }; qPanelLayout.columnWeights = new double[] { Double.MIN_VALUE }; qPanelLayout.rowWeights = new double[] { 0.0 }; panel.setLayout(qPanelLayout); componentCount = 0;
Based on user input I am adding sub-panels to the panel. These sub-panels may vary in height. They take up the full width of the Panel.
public void add(Component comp) { GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(2,2,2,2); gbc.gridx = 0; gbc.gridy = componentCount++; panel.add(comp, gbc_questionPane1); }
The odd behaviour I'm seeing is that if the height of the new sub-panel I'm adding is less than the height of the largest sub-panel currently displayed then the main panel does not repaint. If its height is equal or greater then the Panel does repaint, and any sub-panels that were added but not visible before are now painted. What have I missed?
I tried implementing the bubble sort algorithm into my code, but now my output for the second array (in my code) is giving me a ton of zeros. How I can fix it so the zeros are removed and the only thing that remains in the output for my second array are the fixed numerically?
The first array is the original list of items, and the second array is a copy of the first array, but numerically adjusted.
public static void main(String[] args) { System.out.println("Input up to '10' numbers for current array: "); int[] array1 = new int[10]; int i; Scanner scan = new Scanner(System.in);