Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > file reader returning null when file is not null content

Reply
Thread Tools

file reader returning null when file is not null content

 
 
jason
Guest
Posts: n/a
 
      05-04-2010
On May 4, 2:28*pm, markspace <nos...@nowhere.com> wrote:
> jason wrote:
> > haha

>
> > thanks for humoring me. due to the fact that i have now committed to

>
> I'm not humoring you or answering lightly. *I'm dead serious. *The only
> way to be productive and produce robust, multi-platform GUIs is to use a
> builder tool. *Trying to do this by hand is basically a fool's errand.
> You'll just end up re-inventing the wheel. *Put some effort into
> learning how to make the builder tool do what you want, the long term
> rewards are worth it.
>
> > building the GUI the good old fashioned way i am going to try my best
> > to steer clear of GUI's for GUI's etc.

>
> Learning is OK, just don't loose sight of the overall goal: producing
> code efficiently. *Start with the Java tutorials. *You'll need to
> understand LayoutManagers to lay out by hand. *There's lots of good
> examples of how to layout components manually here:
>
> <http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html>
>
> You should also look up "Separation of Concerns" before rolling too many
> of your own GUI components. *Using a GUI builder will help keep you
> honest there.
>
> > * * * MyButton.setLocation(0,0);

>
> Use "setBounds" to position a component manually. *You will need to
> remove the layout manager first, because a layout manager will call
> setBounds itself to reposition its components. See this example here:
>
> <http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html>




Understood. you have done more than i bargained for. thank you. i am
definitely on my way now.

i cannot thank you enough.
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      05-04-2010
jason wrote:
> [code]
> //file: PopUpColorMenu.java
> import java.awt.*;
> import java.awt.event.*;
>
> import javax.swing.*;
>
> public class PopUpColorMenu extends JFrame
> implements ActionListener {

....
> JMenu File_Menu = new JMenu("File"); //create main menu item
> File_Menu .setMnemonic(KeyEvent.VK_F);


<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>

>
> JMenuItem Def_Save=new JMenuItem("Save As Default");
> Def_Save.setMnemonic(KeyEvent.VK_S);


<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>

....
> JMenuItem Def_Restore=new JMenuItem("Restore Default");
> Def_Restore.setMnemonic(KeyEvent.VK_R);


<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>

....
> JMenuItem File_Exit=new JMenuItem("Exit");
> File_Exit.setMnemonic(KeyEvent.VK_X);


<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>

....
> JLabel JLabel1 = new JLabel("Search: ");
> //JLabel1.setHorizontalAlignment(SwingConstants.LEFT );
> //JLabel1.setVerticalAlignment(SwingConstants.TOP);
> JLabel1.setLocation(100, 100);
> content.add(JLabel1);


<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>
<http://java.sun.com/docs/codeconv/index.html>

....
> public static void main(String[] args) {
> new PopUpColorMenu( );
> }
> }


Always confine GUI calls to the Event Dispatch Thread (EDT) or bizarre bugs
will result.

--
Lew
 
Reply With Quote
 
 
 
 
jason
Guest
Posts: n/a
 
      05-14-2010
On May 4, 2:28*pm, markspace <nos...@nowhere.com> wrote:
> jasonwrote:
> > haha

>
> > thanks for humoring me. due to the fact that i have now committed to

>
> I'm not humoring you or answering lightly. *I'm dead serious. *The only
> way to be productive and produce robust, multi-platform GUIs is to use a
> builder tool. *Trying to do this by hand is basically a fool's errand.
> You'll just end up re-inventing the wheel. *Put some effort into
> learning how to make the builder tool do what you want, the long term
> rewards are worth it.
>
> > building the GUI the good old fashioned way i am going to try my best
> > to steer clear of GUI's for GUI's etc.

>
> Learning is OK, just don't loose sight of the overall goal: producing
> code efficiently. *Start with the Java tutorials. *You'll need to
> understand LayoutManagers to lay out by hand. *There's lots of good
> examples of how to layout components manually here:
>
> <http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html>
>
> You should also look up "Separation of Concerns" before rolling too many
> of your own GUI components. *Using a GUI builder will help keep you
> honest there.
>
> > * * * MyButton.setLocation(0,0);

>
> Use "setBounds" to position a component manually. *You will need to
> remove the layout manager first, because a layout manager will call
> setBounds itself to reposition its components. See this example here:
>
> <http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html>


hey,

one more question in here. everything is working beautifully, now i am
having one issue:
i am trying to run my app outside of netbeans as a .jar file. all
works well but it is in desperate need of a progress bar.

i am trying to implement the following but all i am getting is a
second blank popup window (no progress bar). i am so close (or think i
am) that i can smell it (or maybe i just need to shower).

this UI is popped up after i click a "go!" button or whatever. the
meat of the analysis code executes.

once this starts i would like to watch my progress bar do what it is
made to do. you know. progress!
[code]

public void actionPerformed(ActionEvent arg0) {


JFrame1.setSize(270, 250);
JFrame1.setLocation(200, 200);
JFrame1.setResizable(false);
Insets insets = JFrame1.getInsets();
JFrame1.setLayout(null);
JProgressBar JProgressBar1=new JProgressBar(0,100);
JProgressBar1.setValue(50);
JProgressBar1.setStringPainted(true);
Dimension size=JProgressBar1.getPreferredSize();

JProgressBar1.setBounds(insets.left,insets.top,siz e.width,size.height);
JFrame1.add(JProgressBar1);
JFrame1.setVisible(true); //i can see this. and all
the applied choices are true. i cannot resize and it appears where it
should at the correct size. but lo and behold, not progressbar.

for (int i=0;i<=Out.size()-1;i++){

JProgressBar1.setValue(i);
//other operations..
}
System.exit(0);
}
 
Reply With Quote
 
John B. Matthews
Guest
Posts: n/a
 
      05-14-2010
In article
<5ab965c4-96b2-4ff1-8160->,
jason <> wrote:

> once this starts i would like to watch my progress bar do what it is
> made to do. you know. progress!
> [code]
>
> public void actionPerformed(ActionEvent arg0) {


This would appear to be blocking the Event Dispatch Thread. Instead use
a SwingWorker:

<http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html>
<http://sites.google.com/site/drjohnbmatthews/randomdata>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
Need a Good Quality xD USB Card Reader or Multiple Card Reader Mike Digital Photography 7 08-31-2006 11:20 PM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
card reader for 1 gig type m xd card reader? aaronep@pacbell.net Digital Photography 5 12-16-2005 08:31 PM
PDFs in Acrobat Reader 6.0 with IE 6.0 over Tomcat with Content-Disposition inline can not be displayed siarsky Java 1 02-10-2004 05:31 PM



Advertisments