peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

What is the difference after I change my code to

Did you read linked material? Put it simple, since you have setter methods it would be silly not to use them and instead do another direct assign. Doing such thing is also called "code duplication". {Want t learn more? Read Refactoring: Improving the Design of Existing Code}

By the way, when I run the Employee test, my decimal is like 660.000000, how to change decimal place into 2?

As for this you need to rad something on formatting. Like in your case DecimalFormat

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As mentioned so many times before and now again (since you did not try to search forum) read Beginning J2ME From Novice to Professional - chapter 10 Connecting to the World that will show you have to make HttpConnection with JME and then only thing you need to do is make server side accept your POST/GET request and act upon it. I presume that you know basics of Java web development and how to set JDBC from servlet

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Set method or so often setter method is basically opposite of get method. Where in get method you are getting value of the variable with setter you do set it up. It is also conventional way how to provide access/option to change variable value without making this variable public.
So your following code

public Employee( String f, String l, double m )
	{
		firstName = f;
		lastName = l;
		monthlySalary = m;	
	}
	
	public String getFirstName()
	{
		return firstName;
	}

can be changed to

public Employee( String f, String l, double m )
	{
		setFirstName(f);
		setLastName(l);
		setMonthlySalary(m);	
	}
	
	public String getFirstName()
	{
		return firstName;
	}

	public void setFirstName(String f)
	{
		this.firstName = firstName;
        }

Where the other set methods follow above example

This process is also know as encapsulation, you can read more on it from Sun Certified Programmer for Java book pages 86-89

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

look on this example from jQuery, te email field does essentially what you looking for. You will just need to change events

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Try to run clean build, can be that something got messed up since last changes. What clean build should do for you is remove all *.class files and then either automatically or let you compile whole project again. If you using Maven with your project, then look for "mvn clean" (this can be also executed manually from command line in the project directory)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

OK, I removed website name from there. However I need favour from you in return. Next time when you post any code please use code tags as

[code] YOUR CODE HERE [/code]

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@Lourdupinto to latte with very weak explanation.

Thread closed before another time traveller try to hit

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Official Oracle/Sun tutorial How to Use Trees

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes, that should be possible since you want to just remove a certain data and not entire thread as some students when cheating on school work ;).

Can you point the posts (sorry I feel lazy to go through each of your posts to find it out :) )

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You are looking for something like that for desktop application or you want to do it for web application

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

1. Post the code you actually trying to compile (just to make sure you are not having some errors in it)
2. Post your Java installation details (Java version, where installed, your path value)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

didnt work. on line 20 in still getting the error:

cannot find symbol
symbol: method info()
location: class java.lang.Object

As ztini already provided you been supposed to change all of Object instances to ObjectMaker...

This is what I wanted of you

import java.util.ArrayList;

public class TestArrayList
{
    public static void main(String[] args)
    {
        ObjectMaker item1 = new ObjectMaker();
        ObjectMaker item2 = new ObjectMaker();
        ObjectMaker item3 = new ObjectMaker();

        ArrayList<ObjectMaker> arrayList = new ArrayList<ObjectMaker>();
        arrayList.add(item1);
        arrayList.add(item2);
        arrayList.add(item3);
        System.out.println(arrayList);
        //you made three objs item 1 2 3, added them to arrayList 0 1 2
        //call method on each obj
        for (ObjectMaker om : arrayList)
        {
            om.info();
        }

    }
}
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You asked about converting text to PDF with which I helped you to my best knowledge(even direct linking exact resources you need it). Now you want me to do also file reading? Sorry, but that is not possible. I can possibly help to fix some bugs in my spare time, but I'm damn sure I will not write code for you so you can hand it over to your boss as yours.
Do the task, show what you done and where you face difficulties (as we ask here)or look for help elsewhere...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

What is hard about that?

public class MyTable{
  String col1, col2, col3, col4;

  public MyTable(String str1, String str2, String str3, String str4){
    col1 = str1;
    col2 = str2;
    col3 = str3;
    col4 = str4;
  }

  //getter and setter methods that I desire

  //handy method to print whole object as String
  public void toString(){
    System.out.println(getCol1() + "\t" + getCol2() + "\t" + getCol3() + "\t" + getCol4());
}

Somewhere in text processing class

ArrayList<MyTable> myTableList = new ArrayList<MyTable>();
//reading text

//sample list entries
myTableList.add(new MyTable("", "val2", "val3", val4"));
myTableList.add(new MyTable("val1", "val2", "", val4"));
myTableList.add(new MyTable("", "val2", "val3", "));

for(MyTable printTable : myTableList){
  printTable.toString();
}

So once you read your text file and populated some collection (in my case ArrayList) you can then call upon iText and start printing pdf.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Is it so hard to browse the already linked resources? Wow, look what I found

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Then use iText or similar library

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Well you made mistake on line 7-9 where you initialize Object based on ObjectMaker. Just change Object item1 to ObjectMaker item1 .

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Here is latest Microsoft documentation in regards of driver which includes link where to "Get it" (includes installation details) and also "Beginner's guide"

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

What database you using? Driver is usually better to keep together with project so that in case you try to deploy it on different pc you do not have to go in search for drivers. Drivers are usually kept inside PROJECT_NAME/WEB-INF/lib directory, but sometimes these can be also kept in Tomcat/lib directory. However avoid having same driver in both directories as this can produce strange error messages

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

That connection string doesn't look right, check this documentation from Microsoft

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

There is not much you can do since JME did not improved in last 5-6 years. Newly created LWUIT library seems to be available option, but personally I think it is rubbish, plus not sure which phones actually support it. You can always use Canvas of form with CustomItem, but these are hard to scale for different devices unlike Android.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

TableItem is not standard component of JME (Nothing in official API). You can see it in various plugins for IDEs like NetBeans so be careful with deploying it on real device (you should test it).

This sort of things is either done with list where you show basic data and on selection provide detailed info, or you will do it with CustomItem that let you draw on Canvas and provide you with number of prepared listeners.

PS: This sort of things much easier done with Android or iPhone because of their screen sizes and available components. There is a remote possibility that such component can be available for BlackBerries as their API is more extended the Sun/Oracle ever been/is

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Well the question of code is for you to discus with your colleagues/superior, each company has different policies. For example I'm working for open source company so I'm actually encouraged to share with, where people working for financial institutions and government cannot and therefore usually post snippets usually with some mock service.
If you trust me you can send me by PM your whole mobile project so I can have look at it. However no promises on speed and solution

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Without seeing the code I cannot advice further. Sorry

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

That code is OK. My best guess will be that you either didn't close RecordStore properly or by some mistake you reusing original store before insert of new record. You can find work RecordStore application example hereto compare ideas/solutions

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Your classpath is looking wrong, can you explain double slashes you used? set classpath=%classpath%;.[B]\\[/B]lib[B]\\[/B]gif4j_pro_trial_2.3.jar; Also why don't you add this library through IDE to your project so it is automatically included in your application release, instead of manually adding this library to any computer you wish to run it on?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@masterfact18 please do not create multiple posts to ask same question

@abelingaw, nicely spotted, but please in the future use "Flag Bad Post" button to notify us of issues concerning marked post.

For others, thread is closed. Please follow link in abelingaw post.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Every IDE is best tool in hands of experienced developer and everyone of us here different one. However any IDE in the hands of beginner that is trying to speed up/cheat his way in the process of development and learning it is tool of disaster.
Most used IDEs:

  • Eclipse - free
  • IntelliJ Idea - commercial and community (free) edition
  • NetBeans - free, but recently been buggy again
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

However you are always welcome to submit your code to Dani for examination and help improve forum...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Command.Screen is generic type to enable programmers to build their own commands beside these pre-programmed (OK, Cancel, Back, Stop, Help). Did you checked Beginning J2ME: From Novice to Professional, chapter 5, pg 56 onwards?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As you said is is a number in priority queue. Usually commands with lowest number stay at either edge of screen, in case of higher number of commands at single screen their start to group in one corner and command with lowest number remaining on other other side on its own. Priority number is notoriously know for different understanding/usage by different manufactures and different devices. Do not pay much attention to it

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@fairy1992224 rule of the forum We only give homework help to those who show effort

and for the rest, you should reconsider it how much help is good with given interest from original poster. You maybe helping another lazy programmer after whom you could be fixing errors in real life

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Not exactly, but you can see latest posts if you select main sections like Software Development, Web Development etc. Plus bonus Currently online and Top Members by Rank

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Edit: LOL, beaten by seconds


To go to advance search simple do not fill in search filed and just click on Search button. You will be redirected to form for advanced search where you can set number of search options

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Java is not Java Script. Moving to correct forum...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@123sneha
1) Keep It Clear - Do post in full-sentence English
2) Keep It Organized - Do not hijack old threads by posting a new question as a reply to an old one
3) We only give homework help to those who show effort

Therefore thread closed! If you have more specific questions and code to support it, then you more then welcome to create new thread.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Java Result: -805306369

This doesn't seems to be full error message. Are you getting anything else?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If this is solved can you please click on link below last post "Mark this Thread as Solved".

Thanx

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

No extracting for JAR file. Sometimes libraries in ZIP format have to be extracted otherwise no.

META-INF not sure, what type of project you building? GUI/Web?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You need only netty-3.23.Final.jar , which is in netty-3.2.3.Final/jar folder, this you will add into your "res" folder of your project. Every IDE has it own specific way how to add resources. I made a blog entry some time ago how to do it for NetBeans and IntelliJ IDEA. You can find it here

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Obviously you are missing library that does provide all the stuff your imports are trying to use. Therefore you need to add either the JAR file for the library to your project or add new dependency in your pom.xml if you using Maven. You can get either of them here

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Did you put your initialization in try - catch statement?

try{
  Rectangle rec = new Rectangle(0,0,10,10);
  /*
   * REST OF CODE TO PROCESS
  */
}catch(Exception e){
  e.printStackTrace();
}
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Ok now here are my issues....I know most of you have seen this exact same method done to death BUT what is the point of the coordinates? Why are they needed and what do they do? Did I do the width and height incorrectly and the coordinates are meant to determine these 2 things? I am confused as to why the coordinates x and y are even needed. And also, is my boolean method in my rectangle class correct?
And for my way of checking if both rectangles are equal in my client...is this the correct way of doing it?
I value all and any input please.....criticize my code as harshly as you can so that I can better improve my skills in programming. positive comments are also welcome as the boost morale LOL =)

Coordinates are for giving starting position, without that you wouldn't know where to place the object on the screen

With your equal I think that just with and height comparison would do. I do not see reason to compare it with coordinates if you are not trying to find out if a object is the object you looking for given x,y coordinates with width and height (you may want to ask your tutor on more details for it)

To prevent negative value entry just run a validation check before you assigned values to class variables something like

public Rectangle(int initialX, int initialY, int initialWidth, int initialHeight)
{
  if(validateValues(width, height)){
  x …
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You can try to use jdbc:mysql://localhost/some_db?useUnicode=yes&characterEncoding=UTF-8 see if that works

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Read documentation it does tell you have to set starting value...
As for chance to do combination of character plus number, that is not possible and have to be done programatically, meaning you retrieve ID and prefix it what ever you need and then show it to user

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

When you are declaring your tables you need to use AUTO_INCRMENT for MySQL for example or sequence (seq) for PostgreSQL. You would find similar mechanisms for any database. If you have problem find it, just let us know what DB you are using

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Why you are making more difficult to your self? Why do you not let a user fill in registration form and then on successful submit let him/her know what was auto-generated id in the table?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

What you are looking for is Caret, here is example

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@charlesying
1. Do not post if you have no idea what is answer or better if you have no experiences in the area.
2. Do not post just to show off your signature (that can be easily disabled by admin)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

OK here is solution, enjoy it!

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class JProgressBarDemo extends JFrame {

  protected int minValue = 0;

  protected int maxValue = 100;

  protected int counter = 0;

  protected JProgressBar progressBar;

  public JProgressBarDemo() {
    super("JProgressBar Demo");
    setSize(300, 100);

    UIManager.put("ProgressBar.background", Color.BLACK); //colour of the background
    UIManager.put("ProgressBar.foreground", Color.RED);  //colour of progress bar
    UIManager.put("ProgressBar.selectionBackground",Color.YELLOW);  //colour of percentage counter on black background
    UIManager.put("ProgressBar.selectionForeground",Color.BLUE);  //colour of precentage counter on red background


    progressBar = new JProgressBar();
    progressBar.setMinimum(minValue);
    progressBar.setMaximum(maxValue);
    progressBar.setStringPainted(true);

    JButton start = new JButton("Start");
    start.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Thread runner = new Thread() {
          public void run() {
            counter = minValue;
            while (counter <= maxValue) {
              Runnable runme = new Runnable() {
                public void run() {
                  progressBar.setValue(counter);
                }
              };
              SwingUtilities.invokeLater(runme);
              counter++;
              try {
                Thread.sleep(100);
              } catch (Exception ex) {
              }
            }
          }
        };
        runner.start();
      }
    });

    getContentPane().add(progressBar, BorderLayout.CENTER);
    getContentPane().add(start, BorderLayout.WEST);

    WindowListener wndCloser = new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    };
    addWindowListener(wndCloser);
    setVisible(true);
  }

  public static void main(String[] args) {
    new JProgressBarDemo();
  }
}