Construct And Populate Time Menu

Apr 23, 2014

//construct and populate the Time menu
Menu mnuTime = new Menu("Time", true);
mnuBar.add(mnuTime);
MenuItem mnuCurrentTime = new MenuItem("CurrentTime");
mnuTime.add(mnuCurrentTime);

[Code] ....

E:Calculator.java:64: error: cannot find symbol
if (arg == "Time")
^
symbol: variable arg
location: class Calculator
1 error

Tool completed with exit code 1

View Replies


ADVERTISEMENT

Analog Clock - How To Use Menu To Change Alarm Time

May 10, 2014

the analog clock dese not move put it work when i run the program and the the buttoms dose not work i do not why how i can use the menu alarm to change the alarm time this my code run it.

import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.Timer;

[code]....

View Replies View Related

JSP :: Dynamic Menu Duplicates Every Time A Link Is Clicked

Jan 2, 2015

I have following code to populate a dynamic menu from categories retrieved from database

<jsp:useBean id="category" class="category.CatBean" scope="application"></jsp:useBean>

<c:if test="${applicationScope.cartList == null}">
<c:set var="catList" value="${category.categoryList}" scope="application"/>
</c:if>
<div id="categoryBrowse"><label>Browse by Category</label></div>
<div id="cssmenu">

[Code] ....

It works fine. But every time I click on a link on the menu, it duplicates the whole menu.

View Replies View Related

Reading Json Of Nested Menu Without Giving Menu Names In Java

Aug 14, 2014

I want to read json file as follow;
 
{
  "M": {
  "row": [
  {
  "col1": "c00"
  },
  {
  "col1": "c10",
  "col2": "c11"
  },
  {
  "col1": "c20",
  "col2": "c21",
  "col3": "c22"
  }
  ]
  }
}
 
Next to reading I need to assign to two dimensional array, but without giving "col1","col2","col3" a lot. 

The array is for example, Array[3][] = {{"c00"},{"c10","c11"},{"c20","c21","c22"}};

View Replies View Related

Variables In While Construct

Apr 8, 2014

New to java/programming and i cant understand why the pen variable does not display the the correct value ... For example for input 1 ; 2 ; 3 ; 4 both variables will display 10 and i dont understand why pen does not have the value 6 .

import acm.program.*;
public class Chap4_ex12 extends ConsoleProgram {
public void run () {
int pen = 0;
int r = 1;
int sum = 0;
while (r !=SANTINEL) {
r = readInt(" ? ");
pen=sum ;

[code].....

View Replies View Related

How To Construct A Minimalistic Deadlock

Jan 7, 2015

i'm trying to construct a deadlock deliberately by coding this scenario:

1) Thread A enters a synchronized method of object foo

2) Thread A goes to sleep (thus still holding the key of foo)

3) Thread B enters a synchronized method of object bar

4) Thread B tries to enter a synchronized method of foo (, but cant)

5) Thread A wakes up and tries to enter a synchronized method of bar => deadlock

I'm trying to keep the code really minimalistic, i.e. just 2 threads and 2 objects.

I also dont want to use this syntax:

synchronized(a){
...
}

but would like to achieve this just by calling synchronized methods of 2 different objects (as stated above).

View Replies View Related

JavaFX 2.0 :: How To Force The Row To Construct All Cells

May 20, 2014

In other words in a table view with several editable columns, when a new row is added this row does not contain any column cells yet. Cells are added on demand once a column gains focus and starts editing. Is this the case? Is there any way to force the row to construct all cells eagerly?

View Replies View Related

Cannot Use Variables Inside A Case In Switch Construct?

Mar 1, 2015

If I have an integer variable like int a=9 then in the switch case If i write

switch(a) {
case 4+a: System.out.println("hii");
}

Then why is this statement a compile-time error that variables cannot be used inside a case statement why does the compiler not subtitutes the values in place of the variables.

So basically what problem it creates for which the language developers did not include it as a proper syntax,is there any reason behimd this because of jump table?

View Replies View Related

Swing/AWT/SWT :: Construct A Vertical List Of JPanels

Feb 11, 2014

I am working on writing a desktop based email client using swing. First some specifics: I need to show emails in a (dynamically updatable) vertical list. Each item in this vertical list would represent an email showing: (a) the subject, (b) a photo of the sender that I have locally available & a couple of buttons. So, I plan to create a JPanel containing a JLabel to show the Subject, The photo inside a JLabel & JButtons. I have the layout of this panel done and is not a problem.

My problem is with stacking all these JPanels (each representing an email) and showing them on the UI as a list. I am not sure of any way to do this. Moreover, when a new email is received, it has to be displayed at the top of the list (not at the bottom).

Specifically, I need a good way of displaying a vertical list of JPanels & be able to add new JPanels at the top of the list.

View Replies View Related

Java Read CSV File And Construct A Table

Apr 13, 2014

I am trying to write a program that read from a csv file called matches.csv ... A single football match can end with a win or a draw: in first case the winner team get 3 points and the loser none, in the second case of draw each of the two teams get 1 point.

In the file it contains the following data.

17/08/2013 Arsenal Aston Villa 1 3
24/08/2013 Aston Villa Liverpool 0 1

This means that a match has been played on the 17/08/2013 where Arsenal scored 1 goal while Aston Villa 3 goals: thus Arsenal got 0 points while Aston Villa 3 points.

How can I structure my output to make it make it read

Position Team Played Points
1 Aston Villa 2 3
2 Liverpool 1 3
3 Arsenal 1 0

My code so far:

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Teams {
public static void main(String[] args) {
String fileName = "matches.csv";

[Code] ....

View Replies View Related

Construct Binary Tree And Deserialize Used File

Mar 23, 2014

package SystemandDesign.BinaryTree;
 
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.io.ObjectInputStream;

[Code] ....

So I am having trouble with trying to get the main method to work. The program is supposed to construct a BinaryTree, and deserialize a file that is used for the Tree.

View Replies View Related

Military Time - Adding Minutes Displaying Correct Time

Feb 9, 2015

I am working on an assignment that I can't seem to figure out the final part to. The program takes in course data such as the time the class starts and how long it lasts. The time is in military time (0000 - 2400)

I need the output time to be the time the class started, plus the length of the class, and displayed in military time.

for example,

Start Time = 0930
Length = 50 minutes
Endtime = 1020

I can't for the life of me figure out how to do this. I have gotten a program that works for this time and minutes, and displays the correct 1020. But when I change the information to say

Start time: 0700
Length = 90 minutes

I get:

Endtime = 90

90 is technically correct, the way the formula is setup, but I need it to display 0900 not 90.

Here is the code that I have. Be easy, I'm still learning, and this is just the file I created to get the formula to work. Also, the verbose in here is just for my own debugging to make sure values should be what I'm expecting them to be.

public class calc
{
public static void main(String[] args) {
double hours, minutes, length;
double temp;
int time = 2400;
hours = time / 100;
System.out.println("Hours are: " + hours);

[Code] ....

View Replies View Related

Converting Military Time To Standard Time?

Jan 29, 2014

I have two classes. time_runner is used for testing my code.

This is what I'm using to test my code:
 
class time_runner
{
 public static void main(String str[]) throws IOException {
 Time time1 = new Time(14, 56);
System.out.println("time1: " + time1);
System.out.println("convert time1 to standard time: " + time1.convert());
System.out.println("time1: " + time1);
System.out.print("increment time1 five times: ");
time1.increment();

[code]....

The two constructors are "Time()", which is the default constructor that sets the time to 1200, and "Time(int h, int m)" Which says If h is between 1 and 23 inclusive, set the hour to h. Otherwise, set the hour to 0. If m is between 0 and 59 inclusive, set the minutes to m. Otherwise, set the minutes to 0. Those are my two constructors that I pretty much have down. The three methods however I'm having trouble with. The "String toString()" Returns the time as a String of length 4. The "String convert()" Returns the time as a String converted from military time to standard time. The "void increment()" Advances the time by one minute.

public class Time {
private int hour;
private int minute;
  public Time(int h, int m) {
if(h > 1 && h < 23)
hour = h;

[code]....

View Replies View Related

How To Populate Jlist Using MySQL

Apr 22, 2015

I don t know why this throw a nullpointerexception. i want to add rows from mysql database to my jlist, this is my method populateJlist().

public void populateJlist() throws SQLException {
conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/agenda","root","");
DefaultListModel m = new DefaultListModel();
statement=conn.prepareStatement("SELECT *FROM apunte");
rs=statement.executeQuery();
String itemCode;

[code]...

View Replies View Related

Populate A Database Using Loops

Jan 6, 2014

I am relatively new to Java and I am only beginning to learn about SQL. I have some basic's down but I have been wondering is there a way that I can add data to my database using loops instead of having to physically code every row/column individually ?

View Replies View Related

Populate JComboBox With ArrayList

Oct 2, 2014

I'm trying to populate my JComboBox with an Arraylist. Using two different classes, a GUI class (with the JComboBox - called it MainGui) and a class where I extract information from a database and put it into an ArrayList (which I call databaseconn).In my databaseconn class, I can print out the content of the ArrayList perfectly fine, but when I try to do it in my GUI class it just prints empty brackets "[]".(What I need it to do is to populate the drop down list in the JComboBox with the hotel information).Here's my code:

//The dataaccesslayer you should use for classes that deal with connection to the database

package dataaccesslayer;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

[code].....

View Replies View Related

Populate Array From Database

Apr 14, 2015

I have this working manually, but need creating this from a DB Connection and populating the Array with the results. I just need populating "DestinationItem[]" from the SQL below
 
DestinationBean.java
//  Manual Array works but I need this to be populated from DB using the below Query and DB Connection info.
    private DestinationItem[] destinationResults = new DestinationItem[]{
            new DestinationItem("58285", "Dodge Grand Caravan"),
            new DestinationItem("57605", "Dodge SX 2.0"),
            new DestinationItem("58265", "Chrysler 300 Touring")

[Code] .....

View Replies View Related

JSP :: Dynamically Populate Drop Down List?

Dec 2, 2014

I'm having an issue with populating a dropdown list in my HTML form.

I want the form to pull in the values from the Database. I have a connection and I'm able to populate a table with the values.

Now I'm trying to populate a dropdown within a form that will bring in currency codes that are in a column called CURR_CODE from the Database.

<%
//Declare variables
//String con_currency_sdo = ""; // as New Connection
String ResultSet = "rs"; // as New Command
String Statement = "stmt"; // as New Recordset
String selBaseCurr = request.getParameter("CURR_CODE");

[code]....

View Replies View Related

JSF :: How To Populate Data Table From Excel

Jul 19, 2014

I am using JSF,richfaces. Need to import data from Excel file and show it in datatable.

How to achieve this?

View Replies View Related

How To Populate Jcombobox From MySQL Query

Sep 13, 2014

How could i populate jcombobox2 from MySQL depending upon the value of jcombobox1??

View Replies View Related

How To Populate JTable By Selecting ComboBox Value

Sep 25, 2014

How can I populate the jTable in my form by selecting value from combo box. And remember I have database as well.

View Replies View Related

How To Create A Loop To Populate Activity

Dec 5, 2014

I'm working on my Android project where I created Expandablelistview with men's and women's sports. Now I have to populate each sport with my text data which contains events. I'm stack at this point, already tried few thing but that did not work. Here is my data how it looks like:

this Main (id=831962574768)
groupedFeeds ArrayList (id=831963150464)
array Object[12] (id=831963153088)
[0] GroupedFeed (id=831963152968)
category "Women's Golf" (id=831962986192)
feeds ArrayList (id=831963152992)
[1] GroupedFeed (id=831963153592)

[Code]...

I have here my Main method where I have to pass data to each of my sports(activities). I tried to create a for loop and then pass result to my sport(activity) but I'm doing something wrong and can not get that work. Here is my code:

GroupedFeed findFeed(String locateSport){ //here I tried to create a loop which gonna search for certain sport in array list
//and then pass it to gfResult. }
public boolean onChildClick(ExpandableListView parent,
android.view.View v, int groupPosition, int childPosition,
long id) {
switch (groupPosition)

[Code]...

View Replies View Related

JSP :: Conditionally Populate Attributes Inside Div

Feb 3, 2015

I have the below snippet of code :

<div
<c:if test="${! empty properties['mediatitle']}">
media-title="${properties['mediatitle']}"
</c:if>
<c:if test="${! empty properties['mediawidth']}">
media-width="${properties['mediawidth']}"
</c:if>
</div>

What i want to evaluate the condition inside the markup that is getting populate. Such that If :

Title is empty markup will generate like : <div media-title="title" />

Both are available then markup will generate like : <div media-title="title" media-width="104"/>

How can i achieve this.

View Replies View Related

JSF :: Populate InputText And Its Value Corresponding Of Size Of List

May 8, 2014

I will implement a page where I have a List<String> account, then it will populate inputText and its value corresponding of the size of the List.

For example, I have 10 values in List<String> account, it must populate 10 inputText with value on it and an empty inputText beside it (for the user to input some values on it).

View Replies View Related

Declare Array And Populate It With Log Formula

Feb 10, 2014

Still trying to get a handle on arrays! So, I declare an array to be a 46x1 and I am trying to populate it with a Log formula that I am using but I keep getting an ArrayIndexOutofBoundsException.

Code :

private double[][] LNValues = new double[46][1];
//Calculating y=LN(E-k) and Initializing the Array
for(int x=0; x<LNValues.length; x++)
{
double i = Math.log(eValues[x][1] - kValue);
if(i > 0)

[Code] ....

View Replies View Related

JSF :: Populate PickList - Value Is Not Valid Message

Jan 16, 2015

I am creating a JSF 2.0 project, and I am facing a problem when using the rich:pickList (richfaces 4) component with a custom converter.

I can populate the picklist left column rightly. But, when I move some item from left list to the right (by clicking in the pickList "add" button) and I try to submit the form that contains the pickList, I receive the following error message:

"mainForm:picklist: Validation Error: Value is not valid"

I have already overridden the methods equals and hashCode in my model class (Pessoas.java), but the problem remains.

cadastroEvento.xhtml
<rich:pickList id="picklist" converter="ApresentadorEventoConverter" value="#{CadastroEventoBean.pessoasSelecionadas}" var="pessoa" sourceCaption="Pessoas disponíveis" targetCaption="Pessoas selecionadas" listWidth="365px" listHeight="250px" orderable="false">
<f:selectItems value="#{CadastroEventoBean.pessoas}" />
<rich:column>

[Code] .....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved