 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- Servlet HelpDear Friends
pls help in running servlet in Tomcat. i m not getting which setting
should i do for it.
pls send me how to execute a servlet HalloWorld
paresh
- 1
- Changing the Background Color for One Cell in a JTableI've been working on this for a few hours. I've read tutorials and seen
different examples, but this is still driving me nuts.
I have a table and want to be able to change the color of one cell in it.
It seems to do this, I can't get a cell renderer and just change the color,
I have to create my own class to do that. I've tried that and a number of
other things and can't get it to work.
I finally took the SimpleTableDemo from Sun and checked to make sure it was
running. Once it was, I added four lines:
boolean isSelected = table.isCellSelected(1, 1);
DefaultTableCellRenderer defRender = (DefaultTableCellRenderer)
table.getCellRenderer(1, 1);
Component cellRenderer = defRender.getTableCellRendererComponent(table,
"Huml", isSelected, false, 1, 1);
cellRenderer.setBackground(Color.blue);
(The whole example is at the bottom of this post.)
When I use this example, it turns ALL the cells in the table blue, not just
the one at 1,1.
I've got several questions about this:
1) Do I have to create my own cell renderer to change a cell background
color, or can't I just do it like above? Even when I used my own renderer,
I still got the actual Component named cellRenderer using the same
parameters, so what difference would doing it in a separate class make?
2) The renderer needs the value that is in the cell currently. In my own
program, I got that from the DefaultTableModel I was using. Here I just
used the text that was put in that cell. Is there any way to get the cell
value directly from the table? In this example, I tried getting a
DefaultTableModel (by casting) from the table, but it didn't work, so I
couldn't get the data by reading the cell.
3) Why does this code (above) set the entire table and not just the cell at
1,1?
If anyone has a simpler example of how to set the background color in just a
few lines, I'd be glad to see it. I can't believe how much I need to do
just to change the background color in one table cell!
Thanks for any help/insight!
Hal
----------------example code----------------
/*
* SimpleTableDemo.java requires no other files.
*/
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import com.hal.gui.HalCellRenderer;
public class SimpleTableDemo extends JPanel {
private boolean DEBUG = false;
public SimpleTableDemo() {
super(new GridLayout(1,0));
String[] columnNames = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
Object[][] data = {
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)}
};
final JTable table = new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
// table.setFillsViewportHeight(true);
if (DEBUG) {
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
printDebugData(table);
}
});
}
//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
//Add the scroll pane to this panel.
add(scrollPane);
//======================================================
//Only part I have added is the next four lines
//======================================================
boolean isSelected = table.isCellSelected(1, 1);
DefaultTableCellRenderer defRender = (DefaultTableCellRenderer)
table.getCellRenderer(1, 1);
Component cellRenderer =
defRender.getTableCellRendererComponent(table, "Huml", isSelected, false,
1, 1);
cellRenderer.setBackground(Color.blue);
}
private void printDebugData(JTable table) {
int numRows = table.getRowCount();
int numCols = table.getColumnCount();
javax.swing.table.TableModel model = table.getModel();
System.out.println("Value of data: ");
for (int i=0; i < numRows; i++) {
System.out.print(" row " + i + ":");
for (int j=0; j < numCols; j++) {
System.out.print(" " + model.getValueAt(i, j));
}
System.out.println();
}
System.out.println("--------------------------");
}
/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("SimpleTableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
SimpleTableDemo newContentPane = new SimpleTableDemo();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
- 6
- Java in AT&T PWPHi,
I was referred to you because I'm having a problem getting this to run in
AT&T PWP (Personal Web Pages). I compile the Java Program using NetBeans
IDE 3.6. I upload the .java, the .class and the .html files to my PWP
library.
import java.awt.*;
import java.applet.*;
import javax.swing.*;
public class AppHelloWorld extends JApplet
{
public void init()
{
resize(700,100);
}
public void paint(Graphics g)
{
g.drawString("Hello, Applet world!", 10, 25);
}
}
---------------------------------------------------------------
This is the page I run in the browser (Internet Explorer and Netscape).
<HTML>
<HEAD>
<TITLE>Applet HTML Page</TITLE>
</HEAD>
<BODY>
<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>
<P>
<APPLET code="AppHelloWorld.class" width=350 height=200>
</APPLET>
</P>
<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
</BODY>
</HTML>
This is the message I get from the browser:
java.lang.ClassFormatError: AppHelloWorld (Extra bytes at the end of the
class file)
The page will run in Edit*Plus and IE (FILE, OPEN, BROWSE) and Netscape
(FILE, OPEN FILES, select document).
Can you provide any information on how to get this to run in the browsers?
Wayne Rawls
- 6
- Need server-side solution to linking in framesDear all,
I am doing some maintainance in a JSP website which has been built
using frames (and I cannot remove that unfortunately).
So, I have 4 frames (top, and 3 vertical frames underneath the top).
The frame on the left is supposed to be for navigation, but when I
click on some navigation items, I am enforced to set the target to the
own navigation frame, because I need to do some other processing
(which I cannot avoid), and in the end I am using some javascript code
to change the location of the center frame (which in an ideal case
would be the target of the link on the navigation).
Does anyone know a way to avoid the javascript? Is there anyway that I
can load 2 different urls in 2 different frames via a single link? The
first URL is just a different set of parameters to the navigation
menu, and the second URL is the target of the navigation.
Best regards,
Pablo
- 6
- HAVI packages, where?Hi everyone, I want to download HAVI API packages for java but i don't
know where can i download its. Thank you
- 6
- Text/Console mode UIHi All,
is there anything like swing but working in text mode? I need a simple
user interface working in the console mode for my little app.
thanks
schw
- 6
- How to open dialup connection in Java?Hi everyone,
Who know, how to open dialup connection from Java? (I found only one
way - to run another program (*.bat file), but it's not good idea). Any
another suggestions?
Haim.
- 8
- Writing ASCII for r-232 output into induction machine??I have a machine that uses induction to bond metals together. The
machine has a remote heat station that you set the wattage, and the
time, etc (with up and down buttons) and it will run on its own.
However, every time I need to bond different metals, thicknesses,
widths, etc... I need to reset the info and go through the whole
process again. The machine, has an rs-232 port on the back of it,
which will accept codes written in ascii that will send that pertinent
information to it. I would like some help (Im an ascii newbie) with
writing these programs, so that I can store all the metals,
thicknesses, etc in a laptop connected to this remote heat station, and
then I can have anyone run it so long as they can read.
Any help would be greatly appreciated
Scott
PLEASE email me at email***@***.com
- 11
- Shuffled Poker DeckHi all,
Im new to Java, and as Training for me I tried to build an Application,
which returns a shuffled Pokerdeck. (Random from 1 to 52)
Maybe you will laugh, but i needed a whole day to solve it, and I think its
even not good solution.
Well, at least it works, but please could you give me a hint, how to solve
this problem easier.
Heres the code:
/**
* @(#)Poker.java
*
*
* @author Martin Krainer
* @version 1.00 2007/1/22
*/
public class Poker {
static int[] deck = new int[52];
void buildDeck() { // builds a deck with 52
(hopefully) different Integers
for (int i=0; i<52; i++) {
deck[i] = (int)(Math.random()*10E7);
}
}
void shuffledDeck(int[] a) { // now here I tried hard and
long to get a field with numbers from 1 to 52
long[] zahl= new long[52];
for (int i=0; i<10E7; i++) {
for (int j=0; j<52; j++) {
if (i == deck[j]) {
zahl[j] = j;
System.out.print( " " + (zahl[j]+1) );
}
}
}
}
public static void main(String[] args) {
Poker p = new Poker();
p.buildDeck();
p.shuffledDeck(deck); //well, it works, but...
what do you think?
}
}
- 13
- polymorphic voodoo?Ok, here is what I am trying to decipher. I have the following code
private void someMethod() {
ArrayList list1 = null;
LinkedList list2 = null;
cleverFunction(list1,list2);
}
private void cleverFunction(List first, List second) {
System.out.println("Static type for first is " + .....);
System.out.println("Static type for second is " + .....);
}
Ok, so, given a polymorphic call like this, is it possible, through
whatever witchcraft necessary, to determine what the static types of
the type polymorphic parameters are?
Maybe some sort of interrogation of the stack? Maybe some sorta
reflection?
Ideas?
christian
http://christian.bongiorno.org/resume.PDF
- 13
- Good programming questionI was just wondering as to what is a better standard to program by. If
I have a class like this:
class MyClass {
private int myVariable;
private void myMethod1(){
myVariable = 1;
}
private void myMethod2(){
this.myVariable = 1;
}
}
Which method is better? Is there a better choice? Does it make any
difference which way I do it? Maybe this sounds like an insignificant
question but I have done this both ways and just don't know if there is
a good reason to go one way or the other.
- 13
- Paramaters in EL?Hi All!
Is it possible to do this:
<%String deptName = (String)request.getParameter("deptName");
Department dept = org.getDepartment(deptName); %>
With just c:set or jsp:useBean tags?
Rob
:)
- 14
- 14
- [OT] Teaching OO / Java (was: Concentric Circles Loosing It)Hi !
"Anthony Borla" wrote:
>
> "Alan P" <email***@***.com> wrote in message
> news:br0efp$ola$email***@***.com...
> >
> > I'm a newbie Java student as well, and AFAIK we all start
> > the same way -> by using a 'Turtle' class. Remember those
> > little robot things from infant school, with the penUp(),
> > penDown() etc.
> >
> > The idea is not stunning effects, but an introduction to OOPS
[...]
> I'm just a very firm believer [based mainly anectdotal, not statistical,
> evidence] in teaching programming concepts from first principles which, to
> me, means:
>
> * Teaching the rudiments of console windows / command-line
> usage, which includes the use of editors, compilers, and similar
> tools.
O.k., this is meant to teach the "DE" (leaving out the leading 'I'). But
maybe some people want their students to concentrate on the course theme, so
they decide to use an IDE. Personally, I think one has to know how to deal
with a language without any external (!) IDE, so you should know about
"javac" and "java"...
>
> Taking a Windows environment as an example, all that is needed
> is knowing how to:
>
> - Open up a Command Window
> - Load and use Notepad [or one of its more versatile
> replacements]
> - Invoke javac.exe and java.exe
>
> * Teaching language syntax basics using a serial execution
> programming model, a fancy description for a program
> which executes by starting at point A and proceeding
> downwards towards towards point B e.g.
>
> ...
> public static void main(String[] args)
> {
> // Point A
> ...
> ...
> // Point B
> }
> ...
>
> Once students have grasped the basics of structured / object-based
> programming, all in a serial, non-GUI enviroment, the rudiments of OOP
> [inheritance, polymophism] can be taught.
This will teach students to write programs the serial way first. In my
opinion, it would be the better approach to teach basic OO concepts first
(before even invoking an editor for the first time, maybe using some
pseudo-language).
Using your approach, students would learn how to write an imperative program
frist (one big main() method). Then you would introduce a completely new
paradigm, the structured programming, using functions (other than the main()
method, but still implementing a single class). Later on, you would
introduce yet another paradigm, the object-oriented programming implementing
specialized classes which will focus on certain tasks.
Have you ever tried to teach oo concepts to a - let's say - COBOL programmer
(nothing to say against COBOL programmer, of course, replace with almost any
3GL you (don't) like)? You will have a very hard time unless he (or she)
will understand them, because the imperative paradigm will block their view
onto objects. So I would always prefer to teach the object-oriented way
first. For most people, it will be quite easy to write "one big main()
method" if they are forced to do it, and the oo paradigm will not stand in
their way.
> Once these basics have been
> mastered, the next steps could be taken, which would probably be one, or
> more, of the following:
>
> * Algorithms / Data Structures
Data Structures might well be renamed "Object Oriented Design"... ;-)
> * Concurrent / Advanced Programming
> * Event-driven / GUI Programming
>
> I guess you would describe me as decidedly 'old school' in this regard :)
!
>
> In a nutshell, I'm not comfortable with the notion that GUI's and graphics
> simplify the teaching of very important, fundamental programming ideas,
but
> I probably hold a minority opinion here.
>
> Programming, like mathematics, can be an exciting field. However, much
> effort, most of it in mundane areas, must be expended to satisfactorily
> grasp the basics on which all further learning progress rests. I can
> appreciate course designers wanting to make programming more interesting
or
> accessable, hence the use of GUI's and similar tools, or presenting ideas
in
> graphical form. IMO, though, it is best to avoid such things as they sport
> hidden complexities, and keep things as simple as possible, at least until
a
> firm grounding in the basics has been obtained.
Yes. But one might define "basics" somewhat different. You must not have (I
might even say "should not have") any knowledge about "serial" or
"functional" programming to learn to write good OO programs.
(O.k., I might have started another thread on this, but then...)
Cheers,
Michael
- 16
- Pooling of connectionsHi all,
I've read a few articles about how pooled connections are more
efficient because you don't need to repeatedly setup/teardown a
connection - you just acquire connection from the pool.
Exactly what steps in setting up/tearing down a connection are skipped
by acquiring an already existing connection? Perhaps the steps in
establishing/tearing down a connection would help in answering this
question?
Thanks
Taras
|
| Author |
Message |
yaminb

|
Posted: 2004-10-7 0:02:00 |
Top |
java-programmer, XMLencoder custom
Hey all,
I'm using XML encoder for long term storage. However, I'd like to be
able to customize what is saved at runtime. Why? There are several
data structures, which can balloon the size of the file to a few
megabytes. This data is not something every user might want to save
on load. I'd like to give them the option of whether or not to encode
these particular data structures. The rest of the code is perfectly
capable to dealing with these structures set to null. They often are
null.
I was thinking the easiest way for me to do this would be as follows:
I know this is not XMLEncoder code (but java serialization type
code...but that's what I need help with :) ) I have a feeling this is
going into the realm of persistance delegates, but I really have no
idea.
private Hashtable details= null;
private void writeObject(ObjectOutputStream s) throws IOException
{
if( dontSaveDetails)
{
Hashtable detailsBackup = details;
//clear the details, so they're not saved
setDetails(new Hashtable());
s.defaultWriteObject();
//restore details for the current session
details = bckdetails;
}
else
{
s.defaultWriteObject();
}
}
Any ideas on how to put this logic into the XMLencoder world?
Thanks,
Ymain
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Classes generated by eclipse vs javac have different serialVersionUIDHi,
I'm using eclipse 3.2 for development and have configured my project to
use JDK 1.5.0_07 with Compiler compliance level 1.3 (using default
compliance settings) and selected all "Classfile Generation" options
except "Inline finally blocks." The problem I'm having is that the
class files that are generated by eclipse are not the same as those
generated by javac (also using JDK 1.5.0_07), which is used in a make
script. javac is invoked like so:
javac -source 1.3 -g -d classes -nowarn -deprecation -classpath
<classpath> ...
The different class files cause a problem because I have serialized
some objects already with the javac classes so when I try to
deserialize them with the eclipse classes, I get the
InvalidClassException. When I run serialver on the offending class
file, I get two different values for the class file generated with
javac and the one generated using eclipse.
Has anyone ever had this or some similar problem? How do I correct this
(besides not using the eclipse class files)? I've spent many hours
scouring the web to find a solution, but have had no success. Any help
would be really appreciated!
Thanks,
Tai
- 2
- Maximum number of ThreadsI'm developing a simple Java client that runs over a CORBA server.
The main client thread is waiting for notification from this server.
On each notification,
The client creates a new thread executing some logic with the server and close.
Each session spend most of the time waiting for the server.
At most there can be ~1000 open session.
My questions are:
1. How many threads can be open at the same time
(with response time of up to ~1 second)?
2. Does the JVM open a native thread for each java thread?
I know both question is OS and JVM dependent,
so I'm not expecting exact numbers here. The client will probably run on Solaris or NT.
Thanks.
- 3
- testing websiteHelp please.
Is there any websites that I can use to test my webpage. I am planning to
test a webpage to open DB, most likely I want to open mySql using PHP or
open AccessDB using Java.
Anybody knows any info please also send it to me by email,
email***@***.com
kind regards,
ben mathias
- 4
- xml processing recommendationsHello all,
I need to parse out an xml file within a servlet placing appropriate
element values within a variable that will be stored in a database.
WIth all of the apis out there I am looking for thoughts and
suggestions on the simplest way to pull this data out of the xml
document.
Thanks.
- 5
- convert integer to charI have a jsp
...
${mybean.data}
...
where mybean is a bean and which "data" field. I would like to convert
the integer to char, 1->A, 2->B, 3->C.... How can I do it with jstl,
struts taglib, and anything?
Thanks,
qq
- 6
- Long texts in JTable cellsMy application displays a table having several columns in a JTable.
(the GUI component is bound to a view iterator in Oracle ADF, if
anyone is familiar with that framework.) The problem:
One of the columns contains long text, including line breaks, which
is shown as a very long single line in the table cell. How can I
improve on this? (I guess I want something like an editable text-area,
except it should be part of the table).
Thanks for a hint, Sebastian
- 7
- dependency-detection in java - 3rd TakeMike Schilling <email***@***.com> wrote:
> I've thought about this a bit, though not to the point of creating a design,
> much less building prototypes. It seems to me that this approach is worth
> investigating:
>
> 1. The interface of each class C in the system needs to be captured and
> stored persistently, where "interface" means method signatures, field
> definitions, and constant values. Superclass name too, to cover the changes
> that can occur if what C inherits changes.
Yes, that's a good start.
> 2. Dependencies also need to be captured and stored persistently. This will
> be information of the form:
> . Class D depends on (some feature of) the interface of class C
While I originally thought into that direction, I now have the
impression that this is really too difficult. Afterall there
are a couple of java's features that would need to be taken care
for. (inheritence, compiletime-resolving of fields, static methods
and the choice among overloaded methods)
As long as none of the recently changed classes changes its interface
in an incompatible way(*), the current normal incremental build
suffices.
If any class (well, except for private nested or anonymous ones)
changes its interface such that it is possible for dependent classes
to notice the difference, then a full-rebuild is worth it.
My original point of avoiding full-builds is still fulfilled, because
the full rebuild wouldn't be necessary *everytime*! In the outset,
the problem was, that one either needs to *always* do full-rebuilds,
or risk inconsistencies. Now, it's about a reliable indicator, that
still shouldn't fire too often.
> A. How granular should the dependency information be?
I'd be already happy, if any .class-file's change can be reliably
characterized as incompatible(*) or not.
It wouldn't be a question of which java-file changed, but rather:
Was any .class file changed incompatibly(*) during a normal incremental
build?
> B. How to generate the dependency information. I presume it can be
> calculated from .class file analysis
No, not possible (unless javac was modified), because usage of static
finals is not explicitly "mentioned" in the .class file.
> Inheritance adds some wrinkles. If Sub overrides a method it inherits from
> Super, that doesn't really change its interface. Classes which previously
> called Sub.meth() don't have to be recompiled.
Unless it's a static method :-/ ... where dependent classes might continue
to call Super's version, even if they refer to Sub.meth().
The same goes with fields and overloaded (even non-static) methods.
(*): Chapter 13 of the JLS-3.0 (Java Language Specification 3rd Edition)
mentions (among other allowed changes):
* Adding new fields, methods, or constructors to an existing class or interface.
as a binary compatible change, but it isn't always compatible in our sense.
Our rules for compatibility are stricter, in that they demand
not only linkability, but also "equivalence in behaviour whether
or not a dependent class is recompiled as well".
> I'm sure there are many more of these which further analysis would reveal.
I also fear so ... but once I leave out the problem to list all dependents,
I think that what remains should be possible and still useful.
> One more note: this is an ideal open source project, since it could be
> greatly useful to the development community and there is no money to be made
> by solving it.
I wouldn't say so. Making builds reliable without resorting to always
doing full rebuilds might safe some costs. However, I'm a fan of not
only using open-source, but also contributing to it ...
- 8
- I only invest in Jeff Relf.Hi Hot Tamales !,
You related another gem ( What a guy ),
" Internet and technology stocks
have netted me a loss of approximately 20%.
FCEL, my one energy investment,
has netted me a gain of 20%.
I think Energy
( cells, hydrogen, renewable, even nuclear )
are the next wave. "
The value of FCEL didn't go up,
the value of the dollar,
( i.e. the stock of the U.S. government ), went down.
I only invest in Jeff Relf, not that I'm doing any better.
- 9
- Raymond on Sun's strangleholdanoncoward wrote:
> JTK wrote:
>
>>> This made me think of an issue that has kicked around in my head for a
>>> whle. Just to be clear, IANAL. However, I seem to remember that one
>>> requirement of a patent be that the needed to be non-obvious to a
>>> skilled practitioner. Does someone know if this is correct?
>>
>>
>> Correct but irrelevant. Money talks, justice walks. If Sun wants to
>> shut down a Java implementation, all they need to do is litigate it to
>> death.
>
> How about Mono and .NET. Microsoft has patented the whole lot.
> Mono is *massively* infringing on copyrighted and patented Microsoft IP.
> What's your word on that?
Why would I have a "word on that", especially in a Java forum? You're
the one who love C# so much, you tell us why you prefer it to Java!
- 10
- What it the type of the Class without modifierRoedy Green <email***@***.com> wrote:
> This is one of my pet peeves . It does not have a name. It is
> referred to with religious reverence by an indirect name "default"
> which tells you where in is used. Some heretics dare name it
> "package".
Hey, are you calling me a heretic?!? :)
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
- 11
- Need help in validating the period in an email address. (new Java student)I am a new Java student and would appreciate a little help.
What I need is to be able to validate the period as the fourth from
the last character in an email address and return focus if the address
is invalid. The best I have been able to do is a good address on the
first attempt. If an incorrect address is entered first I am unable to
get it to accept a good address from then on. The code below is what I
have left after removing everything that did not work.
Is there anyone here that can provide some assistance. Thanks
// validate the e-mail
var RegeMail=document.Register.eMail.value
var atSign = RegeMail.indexOf("@")
if (RegeMail == " " || atSign == -1) {
alert("Please enter your e-mail address")
document.Register.eMail.value = " "
document.Register.eMail.focus()
}
- 12
- Java and Jasper reports helphi all,
i am working on a java web app using jasper reports and ireport. i have
just upgraded my ireport copy to v1.2.0.
i have noticed that everytime i compile a report, there are multiple
instances of that file saved in the same folder, with different names.
so for every file i have multiple other files which start with the same
name but have numbers towards the end. eg.
reportA_1144647517990_939916.java
can somebody tell me why is ireport generating all these extra files. i
thought they were backups and have already disabled the backup option
(under options - backup) but it doesnt seem to help.
also i am creating some new sub-reports and i am only getting jrxml and
jasper files, i cant see my java file. all other files have 3 files
except anything new i create. when i compile the report using ireport,
it compiles fine and i can view the report but when i compile the app
using eclipse there is no java file present and hence the compilation
fails.
please help and thanks.
- 13
- JAVA GUI DESIGN SOFTWAREDear:Miss/Mr
May i know where can i get the java software that just similiar to VB
which can be drag and drop for the GUI design.
Thanks
- 14
- Swing runtime problems / Java installation problemsHello all. I have a very simple problem. I am seeking to develop
java apps on mepis linux (ver. 3.4-3). I have installed jdk 1.6.0 and
i am having runtime error problems. It seems like a simple matter,
but i do not know how to solve the problem i am having. I have
compiled the following code directly from the sun website...
package start;
/*
* HelloWorldSwing.java requires no other files.
*/
import javax.swing.*;
public class HelloWorldSwing {
/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Add the ubiquitous "Hello World" label.
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
when i compile, nothing seems to be wrong...
Aesotericon@5[HelloWorldSwing]$ ls
HelloWorldSwing.java
Aesotericon@5[HelloWorldSwing]$ /home/Aesotericon/Documents/jdk1.6.0/
bin/javac HelloWorldSwing.java
Aesotericon@5[HelloWorldSwing]$ ls
HelloWorldSwing$1.class HelloWorldSwing.class HelloWorldSwing.java
Aesotericon@5[HelloWorldSwing]$
when i try to run the program the following happens...
Aesotericon@5[HelloWorldSwing]$ /home/Aesotericon/Documents/jdk1.6.0/
bin/java HelloWorldSwing
Exception in thread "main" java.lang.NoClassDefFoundError:
HelloWorldSwing (wrong name: start/HelloWorldSwing)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:
260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
319)
Aesotericon@5[HelloWorldSwing]$ /home/Aesotericon/Documents/jdk1.6.0/
bin/java .HelloWorldSwing
Exception in thread "main" java.lang.NoClassDefFoundError: /
HelloWorldSwing
Aesotericon@5[HelloWorldSwing]$ unset CLASSPATH
Aesotericon@5[HelloWorldSwing]$ /home/Aesotericon/Documents/jdk1.6.0/
bin/java HelloWorldSwing
Exception in thread "main" java.lang.NoClassDefFoundError:
HelloWorldSwing (wrong name: start/HelloWorldSwing)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:
260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
319)
Aesotericon@5[HelloWorldSwing]$ /home/Aesotericon/Documents/jdk1.6.0/
bin/java .HelloWorldSwing
Exception in thread "main" java.lang.NoClassDefFoundError: /
HelloWorldSwing
As you all see, I have tried several methods of running the program,
but it will not work. I feel like a simpleton, but does anyone have
any suggestions? It seems that java is having a hard time finding
my .class file. I dunno...
J.P.
- 15
- Display XML Formatted in JTextPaneI'm displaying XML in a JTextPane. I was wondering if there was a way
to display the XML formatted with color/text/etc. (Basically, I'm
wondering if I can associated an XML style.) I've searched a bit, but
I haven't been able to get anything to work.
Thanks
|
|
|