 |
 |
Index ‹ java-programmer
|
- Previous
- 2
- Executing a jar fileI have the following code
/*
WinTest.java
*/
import java.io.*;
public class WinTest {
public static void main (String args[]) {
String line;
Process backgroundProcess;
try {
// Start the other process
backgroundProcess = Runtime.getRuntime().exec
("d:\\program files\\cprog.exe");
}
catch (Exception e) {
System.out.println(e);
}
}
}
If I execute the class file from a cmd windown I get the start up
screen from the cprog.exe, however as I would like to dispense with
the dos window I packaged the class into a jar file
First creating a text file called WinTest.txt containin the single
line
Main-Class: WinTest
Then create the jar file
jar cmf WinTest app.jar WinTest.class
I associated the jar file with the java.exe in the SDK lib
But when I double click to execute the jar file a dos window pops up
disappears but no start screen from the cprog.exe is shown
I'm sure it is a severe user error must I have to admit to being
stumped and help would be nuch appreciated
- 5
- Grouphow do i join this group of programmers
- 5
- database content as objectsI wonder what is so appealing in mapping of database content to
predefined Java (or some other language) objects.
There is a problem with joins in he first place. There is lot of coding
and processing overhead.
I found it more elgant to store data in HashMaps. If I need an object,
I could always provide a class with a constructor that takes HashMap as
parameter.
Reporting can be much easier that way, too. I used it in a couple of
projects, and find it very handy.
DG
- 7
- Component inside JList not painting; now resolvedI have set up a JList to work with its own ListModel and
ListCellRenderer. The symptom, my component does not
display any text. That is the list box is
completely blank. From the debugging, I saw it displayed the desired
text. And, we saw that the list box scrolled when there was more data
than can be displayed.
The problem turned out to be that I defined paint() rather than
paintComponent(). What was strange was that I was able to use other
classes extending Component that I wrote and return them
from the ListCellRenderer. These had the same mistake
of putting the display logic in paint() rather than paintComponent();
Yet those Components worked fine and this error in the class notes from
which
I taught our GUI course since 2001.
One of my students , Mr. Kevin Kraus,
elucidated the solution to this problem -- Thanks!
This was also discussed in this group in
relation to a post from John Creighton on September 2 2001.
Since, this is an easy error to make, it is worthwhile having the
reminder, here.
I did not see anything saying this in the FAQ but section 3.4
told our users not to use Component.getGraphics(). They were told
to override "paint()(AWT)" or "paintComponent()(Swing)"
I am sending a suggestion to Mr. Weidenfeller
of new wording to help people trouble shooting their
programs.
Here is my component definition:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class NumberComponent extends JComponent {
String FontName;
String ToDisplay;
int Size;
boolean Selected;
Font f;
void setSelected (boolean S){
Selected=S;
}
NumberComponent (String S) {
ToDisplay = S;
Size = 12;
FontName="Arial";
}
NumberComponent (String S, String F, int size) {
Size=size; FontName = F; ToDisplay = S;
}
public void paint (Graphics g) {
System.out.println ("font Name " + FontName + " Size " + Size);
if (!Selected) {
f = new Font (FontName,Font.PLAIN,Size);
}
else {
f = new Font (FontName,Font.BOLD,Size);
}
//g.setFont(f);
g.setColor(Color.black);
//g.fillRect(10,10,30,20);
g.drawString (ToDisplay,0,0);
System.out.println (" here " + ToDisplay + " hc " + hashCode());
}
public Dimension getMinimumSize() {
if (!Selected) {
f = new Font (FontName,Font.PLAIN,Size);
}
else {
f = new Font (FontName,Font.BOLD,Size);
}
int Width = getFontMetrics(f).stringWidth(ToDisplay);
int Height = getFontMetrics(f).getHeight();
System.out.println (" Width " + Width + "Height " + Height);
Dimension D = new Dimension (Width,Height);
return D;
}
public Dimension getPreferredSize() {
return getMinimumSize();
}
public Dimension getMaximumSize() {
return getMinimumSize();
}
}
Here is the output from the list box that is using it to display:
@toolman#/home/leffstudent/412/final1 >java LMX Numbers.xml
Number Text 33333333Font is Size NC 7754385
Width 64Height 15
Number Text 433333334Font is Size NC 3541984
Width 72Height 15
Number Text 233333332Font is Size NC 4565111
Width 72Height 15
Number Text 33333333Font is Size NC 16164678
font Name Arial Size 12
here 33333333 hc 16164678
Number Text 433333334Font is Size NC 16795905
font Name Arial Size 12
here 433333334 hc 16795905
Number Text 233333332Font is Size NC 28904249
font Name Arial Size 12
here 233333332 hc 28904249
@toolman#/home/leffstudent/412/final1 >exit
exit
Here is the ListCellRenderer I defined:
import javax.swing.*;
import java.awt.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
class NR implements ListCellRenderer {
public Component getListCellRendererComponent (
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
{
Element N = (Element)value;
NodeList NL = N.getChildNodes();
Node TextNode = NL.item(0);
String NumberText = TextNode.getNodeValue();
String Font = N.getAttribute("Font");
String SizeText = N.getAttribute("Size");
System.out.print ("Number Text " + NumberText + "Font is " + Font + "
Size " + SizeText);
NumberComponent NC;
if (Font != null && Font.length() != 0 && SizeText!=null &&
SizeText.length()!= 0) {
int Size = Integer.parseInt(SizeText);
NC = new NumberComponent(NumberText,Font,Size);
}
else {
NC = new NumberComponent(NumberText);
}
NC.setSelected(isSelected);
System.out.println ("NC " + NC.hashCode());
return NC;
}
}
- 7
- Fashion Footwear Industrial Co.,Ltd(Fujian,CHINA) www.fashion-sky.comDear my friend
It is our pleasure to meet you here.
we are wholesaler sport shoes,clothing,electrons in Fujian of China.
our website: http://www.fashion-sky.com
We are professional and honest wholesaler of all kinds of brand
sneaks and apparel.the products
our company supply are as follows:
1).Nike Jordans
Jordan 1 jordan 1.5 jordan 2 jordan 3 jordan 3.5 jordan 4 jordan 5
jordan 5.5 jordan 6 jordan 6.5 jordan 7 jordan 8 jordan 9 jordan 9.5
jordan 10 jordan 11 jordan 12 jordan 13 jordan 13.5 jordan 14 jordan
15 jordan 16 jordan 17 jordan 18 jordan 18.5 jordan 19 jordan 20
jordan 21 jordan 21.5 jordan 22 jordan King jordan Dub Zero Jordan 23
Jordan 7.5
2).Air Force One Air Force one (low) Air Force one (High) Air Force
one (Mid) Air Force one (clear) Air Force One 25 year
3).SHOX Shox R3 Shox R4 Shox R5 Shox TL1 Shox TL2 Shox TL3 Shox NZ
Shox OZ Shox Turbo Show GO Shox CL Shox Coqnescenti Shox Energia Shox
Explodine Shox Monster Shox Rhythmic Shox Warrior
4).Bape Shoes Bape Bape (transparent)
5).Air max AirMax 90 AirMax 95 AirMax 97 AirMax 2003 AirMax 2004
AirMax 2005 Air Max 2006 AirMax 180 AirMax LTD AirMax TN AirMax solas
AirMax 87 AirMax Rift
6).Puma Puma Rpt2 Puma SK6 Puma Jayfi Puma Cir Puma Speed Puma Repli
Puma Future Cat Puma Mostro Puma Lifestyle
7).Dunk SB Dunk High Dunk Low
8).Timberland Timberland High Timberland Low
9).Adidas Adidas 35 Adicolor Country city sense Adidas NBA
11).Prada & Gucci Prada Gucci
12).Footballer Shoes Footballer
13).Locaste
14).converse & Reebok converse Reebok
15).D&G shoes
16).Dsquared2 shoes
17).James shoes
18).Nike King
9).Children shoes Jordan Shox
20).Women shoes Women Jordans Women Shox R3 Women Shox R4 Women AirMax
95&97 Women AirMax 03&06 Women Dunk Women Shox NZ Women AF1
21).sandal & baboosh Nike Puma Gucci Prada
CLOTHES 1).Bape 2).ED Hardy 3).BBC 4).CLH 5).LRG 6).Artful Dodger
Hoodies 7).GINO GREEN GLOBAL 8).10 Deep 9).A&F Coat 11).Jersey NBA
Jersey Football Jersey 12).Juicy Bikini 13).Adidas Coat 14).F1 Coat
15).D&G Coat 16).Superman Coat 17).NBA Coat
JEAN 1).E&D Jeans 2).BBC Jeans 3).BAPE Jeans 4).D&G Jeans 5).EVSIU
Jeans 6).Red monkey 7).COOGI Jeans
T-shirt 1).POLO 2007 polo(women) 2007 POLO IIII(Men) POLO (stripe)
polo (small )
2).Lacoste Lacoste (LONG) Lacoste (SHORT) 3).Name Brand shirt D&G
Shirt Giorgio Armani TN Shirt 4).BBC T-shirt 5).LRG & gina green
glalal 6).Triumvir 7).ED handy 8).Evsiu 9).R.M.B 10).CLOT
Burse & Handbag 1).LV Bag 2).Gucci Bag 3).Dior Bag 4).Chanel Bag
5).Fendi Bag 6).Coach Bag 7).Burberrys Bag 8).Prada Bag 9).Man Leisure
Bag 11).D&G bag 12).nike bag 13).Wallet 14).Suitcase
Electronics 1).Vertu Mobile 2).New iphone Mobile 3).Nokia Mobile
4).moto Mobile 5).PSP Game & memory card 6).Sony Mobile 7).Samsung
Mobile 8).Ipod nano 9).Sony PS3 10).Laptops IBM laptops DELL laptops
Sony laptops ASUS laptops
CAP 1).ED Hardy Cap 2).New Bape & NY Cap 3).RMC Cap 4).New era NBA
5).F1 6).Chanel 7).D&G 8).gucci 9).LV 10).Prada 11).PUMA 12).wool
WATCH 1).Rolex 2).Omega 3).Cartier 4).Chanel 5).Piaget 6).Breitling
7).Bvlgari 8).Corum
Sunglasses 1).Gucci Sunglasses 2).D&G Sunglasses 3).Dior Sunglasses
4).LV Sunglasses 5).Chanel Sunglasses 6).Prada Sunglasses 7).Versace
Sunglasses 8).Giorgio Armani
Strap 1).Bape Strap 2).D&G Strap 3).Gucci Strap 4).LV Strap 5).Scarf
Other 1).Lighter
size chart
Men Size:
US: 7 8 8.5 9 9.5 10 10.5 11 11.5 12 13 14 15
UK: 6 7 7.5 8 8.5 9 9.5 10 10.5 11 12 13 14
EUR: 40 41 42 42.5 43 44 44.5 45 45.5 46 47.5 48 49
Women Size:
US: 5 5.5 6 6.5 7 7.5 8 8.5
UK: 2.5 3 3.5 4 4.5 5 5.5 6
EUR: 35.5 36 36.5 37.5 38 38.5 39 40
Kid's
US: 1 2 3 4 5 6 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5 13 13.5
UK: 13 1 2 3 4 5 6 6.5 7 7.5 8 8.5 9 9.5 10 10.5 11 11.5 12 12.5
EUR:17 18 19 20 21 22 23 24 24.5 25 25.5 26 26.5 27 27.5 28 29 30 30.5
31
Clothing Size:
S M L XL XXL XXXL XXXXL XXXXXL
7.because the space of the website is limited,we can also supply many
other products which be not showed out in our site. if you have the
photos of the products you need , we are pleasure to supply for your
orders.
And our company can supply for our customers ,as follow:
1. top quality.all our products have top quality.
2. most rational price. we offer the most competitive price to you to
open your market. So today most of our products have sold well in the
America, Europe, Middle East, Southeast Asia etc..
3. safe and fast shipment. As different country you are in, we will
deliver the products to you by different ways and pledge to arrive to
your address 100%.and we will send the products to you within 24h
after we get your payment.
4.many products in stock. We have many products in stock and kinds of
size you need , also include kid's.
5.our credit. If the products can be not delivered to your address as
our reason, we will refund the money you paid.
Hope sincerely to have glad and long term business relationship with
you.
If you are interested in our products and have any problem, welcome
to
contact us.
Please trust us , we will be your best choice !!!
Website : http://www.fashion-sky.com
MSN and E-mail: email***@***.com
Yahoo ID:email***@***.com
Michael
Fashion Footwear Industrial Co.,Ltd.(Fujian,CHINA)
- 8
- a common yet hard-to-resolved problem for Java GUI size!The Java application GUI (setPreferSize to some hardcoded dimension)
gets smaller when it comes to wide screen (Dell 16:9 laptop), and the
users have to resize the GUI every time they are launched (so as to see
the action buttons). This problem seems to happen only for 16:9 wide
screen so far.
Question:
1. What are the factors deciding the swing (awt) GUI size, besides
resolution and font? Is wide screen really an individual factor?
2. How to formulate a universal good GUI size? Or any examples to
define different sizes for different display-cases?
Thought the following functions might be needed, although I heard that
Toolkit.getScreenResolution() cannot really detect screen resolution.
Toolkit.getScreenResolution(), Toolkit.getScreenSize(), getFontSize()
Any example or information will be highly appreciated!
- 9
- What's the proper way to use SocketChannel.finishConnect()?What's the proper way to use SocketChannel.finishConnect()?
I've read the documentation but couldn't comprehend what is written for it.
I've seen examples where it is placed:
1a) Right after SocketChannel.connect() (without while loop)
SocketChannel sc = SocketChannel.open();
sc.connect(...);
sc.finishConnect();
sc.configureBlocking(false);
sc.register(selector, SelectionKey.OP_READ);
1b) Right after SocketChannel.connect() (with while loop)
SocketChannel sc = SocketChannel.open();
sc.connect(...);
while (!sc.finishConnect()) {
}
sc.configureBlocking(false);
sc.register(selector, SelectionKey.OP_READ);
2a) When iterating the Selector.select() values (without while loop;
SocketChannel sc = SocketChannel.open();
sc.connect(...);
sc.configureBlocking(false);
sc.register(selector, SelectionKey.OP_CONNECT);
... {
if (sc.isConnectionPending()) {
sc.finishConnect();
}
sc.register(selector, SelectionKey.OP_READ);
}
...
2b) When iterating the Selector.select() values (with while loop)
SocketChannel sc = SocketChannel.open();
sc.connect(...);
sc.configureBlocking(false);
sc.register(selector, SelectionKey.OP_CONNECT);
... {
if (sc.isConnectionPending()) {
while (!sc.finishConnect()) {
}
}
sc.register(selector, SelectionKey.OP_READ);
}
...
- 9
- eclipse doesn't build?
Eclipse doesn't build right now, these seems to be gnome related...
Script started on Thu Apr 14 06:23:31 2005
bsd# make
===> Vulnerability check disabled, database not found
===> Extracting for eclipse-3.0.1_4
=> Checksum OK for eclipse/eclipse-sourceBuild-srcIncluded-3.0.1.zip.
===> eclipse-3.0.1_4 depends on executable: unzip - found
===> Patching for eclipse-3.0.1_4
===> Applying FreeBSD patches for eclipse-3.0.1_4
===> eclipse-3.0.1_4 depends on executable: ant - found
===> eclipse-3.0.1_4 depends on executable: zip - found
===> eclipse-3.0.1_4 depends on executable: unzip - found
===> eclipse-3.0.1_4 depends on executable: mozilla - found
===> eclipse-3.0.1_4 depends on file: /usr/local/jdk1.4.2/bin/java - found
===> eclipse-3.0.1_4 depends on executable: gmake - found
===> eclipse-3.0.1_4 depends on file: /usr/local/bin/intltool-extract - found
===> eclipse-3.0.1_4 depends on file: /usr/X11R6/libdata/pkgconfig/gnome-mime-data-2.0.pc - found
===> eclipse-3.0.1_4 depends on executable: pkg-config - found
===> eclipse-3.0.1_4 depends on shared library: esd.2 - found
===> eclipse-3.0.1_4 depends on shared library: atk-1.0.901 - found
===> eclipse-3.0.1_4 depends on shared library: gconf-2.5 - found
===> eclipse-3.0.1_4 depends on shared library: glib-2.0.600 - found
===> eclipse-3.0.1_4 depends on shared library: gnomevfs-2.1000 - found
===> eclipse-3.0.1_4 depends on shared library: gtk-x11-2.0.600 - found
===> eclipse-3.0.1_4 depends on shared library: art_lgpl_2.5 - found
===> eclipse-3.0.1_4 depends on shared library: bonobo-2.0 - found
===> eclipse-3.0.1_4 depends on shared library: bonoboui-2.0 - found
===> eclipse-3.0.1_4 depends on shared library: glade-2.0.0 - found
===> eclipse-3.0.1_4 depends on shared library: gnome-2.1000 - found
===> eclipse-3.0.1_4 depends on shared library: gnomecanvas-2.1000 - found
===> eclipse-3.0.1_4 depends on shared library: gnomeui-2.1000 - found
===> eclipse-3.0.1_4 depends on shared library: IDL-2.0 - found
===> eclipse-3.0.1_4 depends on shared library: xml2.5 - found
===> eclipse-3.0.1_4 depends on shared library: xslt.2 - found
===> eclipse-3.0.1_4 depends on shared library: linc.1 - found
===> eclipse-3.0.1_4 depends on shared library: ORBit-2.0 - found
===> eclipse-3.0.1_4 depends on shared library: pango-1.0.800 - found
===> Configuring for eclipse-3.0.1_4
Copying plugins/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux.properties into plugins/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_freebsd.properties
Copying plugins/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux_gtk.properties into plugins/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_freebsd_gtk.properties
Copying plugins/platform-launcher/library/motif/make_linux.mak into plugins/platform-launcher/library/motif/make_freebsd.mak
Copying assemble.org.eclipse.sdk.linux.motif.x86.xml into assemble.org.eclipse.sdk.freebsd.motif.x86.xml
Copying assemble.org.eclipse.sdk.linux.gtk.x86.xml into assemble.org.eclipse.sdk.freebsd.gtk.x86.xml
Copying plugins/org.eclipse.pde.source.linux.gtk.x86 into plugins/org.eclipse.pde.source.freebsd.gtk.x86
Copying plugins/org.eclipse.pde.source.linux.motif.x86 into plugins/org.eclipse.pde.source.freebsd.motif.x86
Copying plugins/org.eclipse.platform.source.linux.motif.x86 into plugins/org.eclipse.platform.source.freebsd.motif.x86
Copying plugins/org.eclipse.swt.motif/os/linux into plugins/org.eclipse.swt.motif/os/freebsd
Copying plugins/org.eclipse.jdt.source.linux.motif.x86 into plugins/org.eclipse.jdt.source.freebsd.motif.x86
Copying plugins/org.eclipse.platform.source.linux.gtk.x86 into plugins/org.eclipse.platform.source.freebsd.gtk.x86
Copying plugins/org.eclipse.jdt.source.linux.gtk.x86 into plugins/org.eclipse.jdt.source.freebsd.gtk.x86
Copying plugins/org.eclipse.update.core.linux into plugins/org.eclipse.update.core.freebsd
Copying plugins/org.eclipse.update.core.linux/os/linux into plugins/org.eclipse.update.core.freebsd/os/freebsd
Copying plugins/org.eclipse.core.resources.linux into plugins/org.eclipse.core.resources.freebsd
Copying plugins/org.eclipse.core.resources.linux/os/linux into plugins/org.eclipse.core.resources.freebsd/os/freebsd
Copying plugins/org.eclipse.swt.gtk/os/linux into plugins/org.eclipse.swt.gtk/os/freebsd
Copying plugins/platform-launcher/bin/linux into plugins/platform-launcher/bin/freebsd
Copying features/org.eclipse.platform/linux.motif into features/org.eclipse.platform/freebsd.motif
===> Building for eclipse-3.0.1_4
===> Building libswt.
cd "plugins/org.eclipse.swt/Eclipse SWT PI/gtk/library" && \
/bin/sh ./build.sh && \
/bin/cp *.so ../../../../org.eclipse.swt.gtk/os/freebsd/x86/
gmake[1]: Entering directory `/usr/ports/java/eclipse/work/plugins/org.eclipse.swt/Eclipse SWT PI/gtk/library'
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic -c swt.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic -c callback.c
cc -shared -fpic -o libswt-gtk-3063.so swt.o callback.o
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags gtk+-2.0` -c os.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags gtk+-2.0` -c os_structs.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags gtk+-2.0` -c os_custom.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags gtk+-2.0` -c os_stats.c
cc -shared -fpic `pkg-config --libs gtk+-2.0 gthread-2.0` -L/usr/X11R6/lib -lXtst -o libswt-pi-gtk-3063.so swt.o os.o os_structs.o os_custom.o os_stats.o
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags atk gtk+-2.0` -c atk.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags atk gtk+-2.0` -c atk_structs.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags atk gtk+-2.0` -c atk_custom.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags atk gtk+-2.0` -c atk_stats.c
cc -shared -fpic `pkg-config --libs atk gtk+-2.0` -o libswt-atk-gtk-3063.so swt.o atk.o atk_structs.o atk_custom.o atk_stats.o
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` -c gnome.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` -c gnome_structs.c
cc -O -Wall -DSWT_VERSION=3063 -DFREEBSD -DGTK -I/usr/local/jdk1.4.2/include -I/usr/local/jdk1.4.2/include/bsd -I/usr/local/jdk1.4.2/include/freebsd -I../../../Eclipse_SWT/common/library -I../../../Eclipse_SWT_PI/gtk/library -I/usr/X11R6/include -fpic `pkg-config --cflags gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` -c gnome_stats.c
cc -shared -fpic `pkg-config --libs gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` -o libswt-gnome-gtk-3063.so swt.o gnome.o gnome_structs.o gnome_stats.o
/usr/bin/ld: cannot find -lpopt
gmake[1]: *** [libswt-gnome-gtk-3063.so] Error 1
gmake[1]: Leaving directory `/usr/ports/java/eclipse/work/plugins/org.eclipse.swt/Eclipse SWT PI/gtk/library'
gmake: *** [libswt] Error 2
*** Error code 2
Stop in /usr/ports/java/eclipse.
- 9
- [OT] Re: Viewing and Changing Settings"news" <email***@***.com> wrote in message
news:ezLCb.1561$email***@***.com...
>
> I want to see my settings for java. How do I see the settings
> using set on DOS screen??
>
Type:
set
and press <ENTER>; you should find a number of items displayed:
PATH=...
CLASSPATH=...
>
> My problem is when I type in set and nothing shows.
> I go to the directly where java.exe is located and type
> set and nothing.
>
I find this a highly unusual situation. Ordinarily, you would have at least
a couple of environment variables displayed.
>
> How do I change the settings like CLASSPATH
>
To create a CLASSPATH enviorment variable where none exists, do:
set CLASSPATH=C:\XYZ;D:\ABC
and press <ENTER>.
To add information to an existing CLASSPATH [you can choose whether to place
it before or after existing data] do:
:: Before existing data
set CLASSPATH=%classpath%;C:\XYZ;D:\ABC
or:
:: After existing data
set CLASSPATH=C:\XYZ;D:\ABC;%classpath%
and press <ENTER>.
Note, though, this changes the settings for the current console window [i.e.
DOS Window] only - the settings are lost once you close it. For a more
permanent solution:
* Edit 'autoexec.bat' file to include the above statements - this
applies to older Windows versions
* Use the System applet in the Control Panel to edit Enviromnent
Variables [for W2K, and XP]
I hope this helps.
Anthony Borla
- 10
- [ANN] Excelsior JET 6.0 (AOT compiler) Supports Java SE 6Excelsior JET (http://www.excelsior-usa.com/jet.html) is a complete
Java SE 6 implementation enhanced with an Ahead-Of-Time (AOT)
compiler. It is certified Java Compatible on a number of Windows and
Linux platforms, including Windows Vista and RHEL 5.
http://www.excelsior-usa.com/jetlatest.html provides full information
on new features and improvements.
http://www.excelsior-usa.com/jetdleval.html has free trial downloads
available (registration is optional.)
http://www.excelsior-usa.com/jetfree.html offers a free license
to authors of non-commercial Java software.
- 11
- layouts layouts layouts..Andrew Thompson wrote:
> On Fri, 02 Sep 2005 12:09:47 -0400, Frances wrote:
>
> ..
>
>>>- Your button should occupate SOUTH (Looks like you want button to
>>>occupate all available place)
>>
>>no I don't!! that's just how it's coming out, can't figure out how to
>>control size for it (as I said, setSize() is being ignored..
>
>
> 'size' is often ignored, while prefered/minimum/maximum
> are more likely to be honored. Some layouts will ignore
> even the latter in some circumstances, especially like
> BorderLayout.CENTER.
>
>
>>..(I have been wondering, though, about BorderLayout, I
>>don't see WEST in yr post, I've been wondering if it's ok to use
>>BorderLayout if you don't fill all five "corners".. (NORTH, SOUTH,
>>CENTER, EAST, WEST..)
>
>
> Yes. BorderLayout allows 5 components, but can accept less.
great.. thank you Andrew, I really had been wondering about this...
again many thanks Andrew, to you and to all who responded... I got lots
to chew on here for the weekend now...
:)
- 11
- developing web browser and email clientHi people...
I am planning to develop a webbrowser and e-mail client..but i haven't
done this work before.
Can you please tell me which language is the best to go ahead with it
? And what are the prerequisites that i need to learn ?
I'll be thankful
Regards
Anupam
I am planning to create a s/w package that'll install both of these..
- 14
- Differences between C++ and JavaOn 1 Dec 2005 10:25:38 -0800, "AndyRB" <email***@***.com> wrote,
quoted or indirectly quoted someone who said :
>The problem is many newbies (quite possibly
>Roedy's target audience) are ignorant of undefined behaviour and think
>that if their c++ code simply compiles then it must be valid c++.
That is not the issue. The issue is whether there are mechanisms to
detect the error or you simply get undefined results.
Think for example writing C code where you failed to initialise a
variable. This was legal. Most of the time it was initialised to 0.
But sometimes it was not, leading to a need for a timeout in a padded
cell. It STRONGLY matters if the compiler/run time can detect the
error.
It is almost irrelevant if the given code is technically legal.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
- 16
- Beware of disabled ActionHi !
just a note to warn you about some javax.swing.AbstractAction problem
My GUI dispays a JButton.
depending on the user's state, I do a setAction(AAction)
or a setAction(BAction).
AAction and BAction each extend AbstractAction and possess their own icon
(ImageIcon).
Here is a sample scenario :
1) button.setAction(AAction)
2) AAction.setEnabled(false)
3) button.setAction(BAction)
4) BAction.setEnabled(false)
the result of this is : the Action linked to the button is BAction as
expected, and the icon is...AAction's disabled icon (original icon greyed).
The only workaround I've found is to do button.setDisabledIcon(null) before
any new setAction()
It seems that an AbstractAction doesn't possess a disabled icon on its own,
and relies on the JComponent's one.
The first time, 1) and 2) have the consequence of creating a disabled icon
for my button , which doesn't have any at the beginning.
Then, 3) and 4) won't change this disabled icon, because the button now has
one
Regards,
Arnaud
- 16
- What means %10.7f?Hi,
My code has:
System.out.printf("%10.7f", aDouble);
My intention is to print out the value of a double variable following
the rule: a)the maximum space is 10; b)have 7 digits after the decimal
point.
But there is a bug here, I found. If aDouble < 100, it is fine; If
aDouble >= 100, it will take 11 spaces, instead of 10 spaces. So I have
to manually change 10.7f to 10.6f. What a pain!
Could you help me out? Thank you.
|
| Author |
Message |
christoff_pale

|
Posted: 2004-1-7 6:13:00 |
Top |
java-programmer, jtextarea and html
Hi,
Is it possible for me to setup up jtextarea such that
it renders html.
Suppose I create a but "interpret html" which when clicked
goes through the text in jtextarea and
adds styles
for example if I have something like
<b>bold text here</b>
then this should be bold. Furthermore, it should hide these html
tags but not delete them, that way when i save the text, i save the html
tags as well.
thanks for any advice
|
| |
|
| |
 |
ak

|
Posted: 2004-1-7 7:41:00 |
Top |
java-programmer >> jtextarea and html
> Is it possible for me to setup up jtextarea such that
> it renders html.
no.
use JTextPane
____________
http://reader.imagero.com the best java image reader.
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-1-7 13:56:00 |
Top |
java-programmer >> jtextarea and html
"Christoff Pale" <email***@***.com> wrote in message
news:email***@***.com...
| Hi,
| Is it possible for me to setup up jtextarea such that
| it renders html.
Short answer no. Long answer Nope.
If you subclassed JTextArea, you could add
the functionality, but that would not be a
JTextArea anymore.
OTOH - JTextPanes and JEditorPanes
_do_ style text, you would be better off
investigating them.
HTH
|
| |
|
| |
 |
Manolis Christodoulou

|
Posted: 2004-1-7 21:25:00 |
Top |
java-programmer >> jtextarea and html
Andrew Thompson wrote:
> "Christoff Pale" <email***@***.com> wrote in message
> news:email***@***.com...
> | Hi,
> | Is it possible for me to setup up jtextarea such that
> | it renders html.
>
> Short answer no. Long answer Nope.
>
> If you subclassed JTextArea, you could add
> the functionality, but that would not be a
> JTextArea anymore.
>
> OTOH - JTextPanes and JEditorPanes
> _do_ style text, you would be better off
> investigating them.
>
I have the same problem, I want to display HTML formating text. I tried
JTextPane and JEditorPane myself. I placed them in a JFrame with
BorderLayout in the EAST side. But it seems that every time I try to
resize the window, the JTextPane or the JEditorPane cover all the JFrame
area. JTextArea works as expected. What is the problem?
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-1-8 14:00:00 |
Top |
java-programmer >> jtextarea and html
"Manolis Christodoulou" <email***@***.com> wrote in message
news:email***@***.com...
| ..What is the problem?
What is the SSCCE?
http://www.physci.org/codes/sscce.jsp
|
| |
|
| |
 |
Adam

|
Posted: 2004-1-9 15:35:00 |
Top |
java-programmer >> jtextarea and html
> I have the same problem, I want to display HTML formating text. I tried
> JTextPane and JEditorPane myself. I placed them in a JFrame with
> BorderLayout in the EAST side. But it seems that every time I try to
> resize the window, the JTextPane or the JEditorPane cover all the JFrame
> area. JTextArea works as expected. What is the problem?
Do you have anything else in that JFrame? If you dont then it behaves as
expected:
the component consumes all the space left.
Adam
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- nio sockets + SetTcpNoDelay Exception...Hi,
I use Nio sockets in a production projet for a while, without a single
problem.
Today, without having made any change to the code, I had the bad surprise to
see the following exception in my logs :
java.lang.ClassCastException
at sun.nio.ch.OptionAdaptor.<init>(OptionAdaptor.java:27)
at sun.nio.ch.SocketAdaptor.opts(SocketAdaptor.java:253)
at sun.nio.ch.SocketAdaptor.setTcpNoDelay(SocketAdaptor.java:258)
at aks.net.AKSAcceptDaemon.run(AKSAcceptDaemon.java:135)
My code looks like : (file AKSAcceptDaemon.java)
Selector m_acceptSelector ;
... // selector initialisation
while (m_bRunning)
{
Set readyKeys ;
Iterator it ;
SelectionKey sk ;
ServerSocketChannel ssc ;
SocketChannel client;
while ( m_acceptSelector.select() > 0)
{
readyKeys = m_acceptSelector.selectedKeys();
it = readyKeys.iterator();
// Walk through the ready keys collection and process
date requests.
while (it.hasNext())
{
sk = (SelectionKey)it.next();
it.remove();
if (sk.isAcceptable())
{
ssc = (ServerSocketChannel)sk.channel();
client = ssc.accept();
client.configureBlocking(false) ;
// HERE IS THE GUILTY LINE
client.socket().setTcpNoDelay(false);
// HERE ENDS THE GUILTY LINE
client.socket().setKeepAlive(false);
m_engine.addNewClient(client) ;
}
}
}
}
}
Does someone see what can be the reason of this ?
I made a search on newsgroups, but didnt' found any answer.
Thanks in advance,
Cam
PS : sorry for my crap english : I'm french and frenchies have never been so
good at foreign languages :p
- 2
- Font Faces and Styles Not SetI'd like to see if anyone can offer an explanation for some font
issues before I report the issues as bugs to Sun and Apple. Please let
me know if you can explain the following as correct behavior.
It appears to me that a lot of fonts simply don't work under Java 1.4.
The simple application below should show fonts with a normal face,
bold, italic and underline. Underline seems to work on all systems,
but on both Windows and OS/X, bold and italic fail on many fonts. The
same fonts seem to have bold and italic faces in non-Java
applications, so it appears to be a problem with the JVM. For example,
STENCIL on the Mac and Century on Windows both have distinct bold and
italic faces in Word, but not in Java.
On OS/X, many fonts do not display the proper face; they seem to
default to serif or sans serif. Most of the Lucida fonts show this
problem.
Mike Westerfield
--- main.java ---
package fonttest;
public class Main {
public Main() {
Window window = new Window();
window.show();
}
public static void main(String[] args) {
Main main1 = new Main();
}
}
--- window.java ---
package fonttest;
import java.awt.*;
import javax.swing.*;
import javax.swing.text.*;
public class Window extends JFrame {
private JScrollPane jScrollPane1 = new JScrollPane();
private JTextPane jTextPane = new JTextPane();
public Window() {
try {
jbInit();
pack();
populate();
} catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
jScrollPane1.setPreferredSize(new Dimension(640, 480));
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setTitle("Font Test");
this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(jTextPane, null);
}
private void populate () {
String defaultFont = "SanSerrif";
String[] fontNames =
GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int f = 0; f < fontNames.length; ++f) {
jTextPane.getCaret().setDot(Integer.MAX_VALUE);
setFont(defaultFont, false, false, false);
jTextPane.replaceSelection(fontNames[f] + "\t");
jTextPane.getCaret().setDot(Integer.MAX_VALUE);
setFont(fontNames[f], false, false, false);
jTextPane.replaceSelection("Abcdef" + "\t");
jTextPane.getCaret().setDot(Integer.MAX_VALUE);
setFont(fontNames[f], true, false, false);
jTextPane.replaceSelection("Abcdef" + "\t");
jTextPane.getCaret().setDot(Integer.MAX_VALUE);
setFont(fontNames[f], false, true, false);
jTextPane.replaceSelection("Abcdef" + "\t");
jTextPane.getCaret().setDot(Integer.MAX_VALUE);
setFont(fontNames[f], false, false, true);
jTextPane.replaceSelection("Abcdef" + "\n");
}
}
private void setFont(String name, boolean bold, boolean italic,
boolean underline) {
SimpleAttributeSet font = new SimpleAttributeSet();
font.addAttribute(StyleConstants.FontFamily, name);
font.addAttribute(StyleConstants.FontSize, new Integer(16));
font.addAttribute(StyleConstants.Bold, new Boolean(bold));
font.addAttribute(StyleConstants.Italic, new Boolean(italic));
font.addAttribute(StyleConstants.Underline, new
Boolean(underline));
jTextPane.setCharacterAttributes(font, false);
}
}
- 3
- NumberFormatException:please help me......!!!Hi,
i have a question and i need your help.
I'm developing a java application that have to import data from a txt
file as
3.2 2.1 4.5 6.7 2.3 4.5 3.4 5.5
2.1 3.2 4.7 2.1 3.5 6.7 5.6 3.1
The application counts rows number and columns number and import data
into a bidimensional array of double type.
I compile my code and i have this error
Exception in thread "main" java.lang.NumberFormatException: For input
string: "3
..2 2.1 4.5 6.7 2.3 4.5 3.4 5.5"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown
Source)
at java.lang.Double.parseDouble(Unknown Source)
at AddDb.ReadArray(AddDb.java:51)
at AddDb.main(AddDb.java:97)
How can i do?
Please help me with code, i'm a new java user...
Here is my code
import java.util.*;
import java.io.*;
public class AddDb {
private static String fileName="Dato.txt";
private static int Ncolumns=0;
private static int Nrows=0;
public int ColumnsNumber(BufferedReader br)throws IOException {
String line = br.readLine(); //legge una linea di testo terminata
da /n o /r e la restituisce come stringa
StringTokenizer st = new StringTokenizer(line);
Ncolumns=st.countTokens();
return Ncolumns;
}
public int RowsNumber(BufferedReader br)throws IOException {
String line = br.readLine();
while (line != null) {
Nrows++;
line = br.readLine();
}
return Nrows;
}
public double[][]ReadArray(int Nrows,int Ncolumns,BufferedReader
br)throws IOException
{
double[][]x=new double[Nrows][Ncolumns];
for(int i=0; i<Nrows; i++)
{
StringTokenizer tok=new StringTokenizer(br.readLine(),"");/
for(int j=0; j<Ncolumns; j++)
{
x[i][j]=Double.parseDouble(tok.nextToken().trim()) }
}
for(int i=0; i<Nrows; i++)
{
for(int j=0; j<Ncolumns; j++)
{
System.out.println("L'array bidimensionale ?+x[i][j]);
}
}
return x;
}
public static void main(String[] args)throws IOException {
FileReader file = new FileReader(fileName); BufferedReader br =
new BufferedReader(file);
AddDb db=new AddDb();
br.mark(99999);
db.ColumnsNumber(br);
System.out.println("Il numero di colonne e' :"+Ncolumns);
br.reset();
br.mark(99999);
db.RowsNumber(br);
System.out.println("Il numero di righe e' :"+Nrows);
br.reset();
System.out.println("Caricamento dell'array di double in
corso.....");
try
{
System.out.println(db.ReadArray(Nrows,Ncolumns,br));
}
catch(IOException e){
System.out.println(e.getMessage());
}
br.close();
}
}
- 4
- ZoneView: does it work?I'm going to repeat a question that i've asked in javalobby to no
avail.
Did anyone ever got zoneview working for a JEditorPane and if so how?
I'm using a custom stylededitorkit that implements view factory and my
factory code looks like this:
public View create(Element elem) {
String name = elem.getName();
if (name != null) {
if (name.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (name.equals(AbstractDocument.ParagraphElementName)) {
return new CountingParagraphView(elem,observer);
} else if (name.equals(AbstractDocument.SectionElementName)) {
return new ZoneView(elem, View.Y_AXIS);
} else if (name.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
}else if (name.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
Ignore the contngparagraph view, its just something i did to be able to
tell the amount of text visible.
Using zoneview here gives an nullpointerexception in the guts of swing,
in AsyncBoxView i think.
I'm just looking for a way not to load to the views the entire text at
a time (That is sloooow). And getting an indicator of the index of
text. I'm going to append my editor kit and textpaintobserver if you
want to see how it works (to make it work, just replace zoneview with
boxview in the method above).
/**
*
*/
package ui;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
import javax.swing.SwingUtilities;
import javax.swing.text.AbstractDocument;
import javax.swing.text.BoxView;
import javax.swing.text.ComponentView;
import javax.swing.text.Element;
import javax.swing.text.IconView;
import javax.swing.text.JTextComponent;
import javax.swing.text.LabelView;
import javax.swing.text.ParagraphView;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledEditorKit;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
class TextCountingEditorKit extends StyledEditorKit implements
ViewFactory{
/**
* Observer given in the constructor.
*/
private final TextPaintObserver observer;
private static final long serialVersionUID = -7828351555750309111L;
public TextCountingEditorKit(TextPaintObserver observer) {
super();
this.observer = observer;
}
public ViewFactory getViewFactory()
{
return this;
}
public View create(Element elem) {
String name = elem.getName();
if (name != null) {
if (name.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (name.equals(AbstractDocument.ParagraphElementName)) {
return new CountingParagraphView(elem,observer);
} else if (name.equals(AbstractDocument.SectionElementName)) {
return new ZoneView(elem, View.Y_AXIS);
} else if (name.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
}else if (name.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
/**
* Counting paragraph view
*/
class CountingParagraphView extends ParagraphView {
private Rectangle line;
private Rectangle win;
private TextPaintObserver observer;
public CountingParagraphView(Element elem, TextPaintObserver
observer){
super(elem);
//strategy = new MyFlowStrategy(); TODO
line = new Rectangle();
win = new Rectangle();
this.observer = observer;
}
/**
* Overrides the normal paint method for eliminating
* cut lines at the top and bottom of the viewport
* and for counting the number of visible chars from
* the model (without added \n from line-wrap,or tabs)
* the visible chars are derivated by subtracting
* two variables of the class, first and last,
* who this method updates, and who is the responsability
* of the component that wants to know them to rest afterwards
* @param g
* @param a
*/
public void paint(Graphics g, Shape a) {
Rectangle box = (a instanceof Rectangle) ? (Rectangle)a :
a.getBounds();
SwingUtilities.calculateInnerArea((JTextComponent)getContainer(), win);
int n = getViewCount();
int x = box.x;
int y = box.y;
for (int i = 0; i < n; i++) {
line.x = x + getOffset(X_AXIS, i);
line.y = y + getOffset(Y_AXIS, i);
line.width = getSpan(X_AXIS, i);
line.height = getSpan(Y_AXIS, i);
View view = getView(i);
//g.draw3DRect(line.x,line.y,line.width,line.height,true);
if ( win.contains(line) ) {
int startOffSet = view.getStartOffset();
//Lame document default behavior workaround (see
AbstractDocument)
int endOffSet = (view.getEndOffset() >
getDocument().getLength() ) ? view.getEndOffset()-1:
view.getEndOffset();
if( startOffSet < observer.getFirst()){
observer.setFirst(startOffSet);
}
if( endOffSet > observer.getLast()){
observer.setLast(endOffSet);
}
paintChild(g, line, i);
}
}
}
}
}
package ui;
import java.lang.reflect.InvocationTargetException;
import javax.swing.SwingUtilities;
import javax.swing.text.JTextComponent;
public class TextPaintObserver {
private int first;
private int last;
private JTextComponent text;
public TextPaintObserver(JTextComponent text) {
reset();
this.text = text;
}
public void setFirst(int in) {
this.first = in;
}
public void setLast(int in) {
this.last = in;
}
public int getFirst() {
return (this.first == Integer.MAX_VALUE) ? 0 : first;
}
public int getLast() {
return (this.last == Integer.MIN_VALUE) ? 0 : last;
}
/**
* Resets the state of the observed values
*/
private void reset(){
first = Integer.MAX_VALUE;
last = Integer.MIN_VALUE;
}
/**
* Gets the visible length
*/
public int getInterval(){
resetState();
return getLast() - getFirst();
}
/**
* Causes the state of the visible length to
* be updated
*
*/
private void resetState(){
reset();
if(SwingUtilities.isEventDispatchThread()){
text.paintImmediately(text.getBounds());
}
else{
try {
SwingUtilities.invokeAndWait(
new Runnable(){
public void run(){
text.paintImmediately(text.getBounds());
}
}
);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
- 5
- Manifest.mf Class-path troubleHi group!
I'm deploying an application with this structure
app
app/app.bat
app/lib/app.jar
app/lib/another.jar
app/plugins/other/
where the (windows) batch file starts the application like so:
java -jar lib\app.jar
and the Manifest.mf with that jar puts another jar on the classpath
like so:
Class-Path: another.jar
Now I also want to put any plugin classes that users put into
app/plugins/other/ onto the classpath, roughly like so:
Class-Path: another.jar "../plugins/other/*"
So far I've tried a few variations, but the development cycle is quite
tedious and it ain't workin yet.
I'm wondering:
* use quotes ?
* forward slashes ok on windows or do I need separate versions for Win
vs Unix ?
* end the directory with / (or resp. \) or nothing (../plugins/other) ?
* end the directory with "/*" or possibly "/*.class" ?
Alternatively I could use the java -classpath arg in the batch file,
but I've tried that and it's not working either, so I'm getting the
impression that using the Class-path: line in the manifest somehow
disables the -classpath arg of the java command. Is that so?
YT
- 6
- Java localization on MacDear developers,
I made a Java application. I packed it as an ".app" container using Jar
Bundler, then I launched the ".app" and I saw that the standard menu
(the one with About and Quit commands) is in English and not in my
system's default language. How can I get it localized?
Thank you :)
- 7
- Pipelining COM portsIs it possible to create a pipeline to virtual COM port (MS Windows)?
I connect a mobile phone to PC over Bluetooth and
[CommPortIdentifier.getPortIdentifiers();] does not enumerate any port,
neither COM1 nor virtual port for mobile phone.
If I use [new FileOutputStream("COM10");] then I can send data to
mobile phone but I can't read the response.
Basically, I need to open a pipeline to file. Where can I find more
information on this topic?
- 8
- intersection model with threads problemX-No-Archive
Hello,
I am trying to learn java threads, and to attempt an exercise from my
textbook, hwever I am not sure if any of my proposed solutions are in
the right vein...
The problem is to model an intersection with trafficlights and 2
sensors at each trafficlight, one for arriving and entering, and one
for exiting..., and cars as threads.
the time the car stays in for, the length of time it takes the lights
to switch colors, and the number of cars must all be definable and easy
to change..
I was consiering having each car as a thread, and sensors and
trafficlights as a monitors, when a sensor detects a car arriving, it
notifies the trafficlight to change, and trafficlight will block or
allow the car thread to run, ie enter or leave...
I'm not sure if I am even on the right track, and can not find any
example solutions to this problem, so if anyone has any idea I would be
very gratefull
Thanks,
Jason
- 9
- Programming with JCo (SAP)Hi,
I hope there is someone out there with programming experiences in SAP
over Jco.
Unfortunately I have no SAP System here to test my code with.
In the documentation is written:
------
JCO.Repository mRepository;
mRepository = new JCO.Repository("ARAsoft", mConnection);
We invoke the constructor for JCO.Repository with two parameters; the
first one is an arbitrary name, the second one either a connection pool
name or a JCO.Client object. In other words: Both connection pooling and
direct connections are supported. In (web) server applications, we
should always use a connection pool for the repository. The userid used
for the repository has to have sufficient authorizations in SAP for the
metadata access to be possible. Please read the Javadoc for class
JCO.Repository to find out which specific authorizations are required.
You can use one special userid for the repository access and one or more
"normal" userids for the actual application.
------
I have the following code I was able to test on a foreign system:
public JCO.Function getFunction(String repositoryName, String
functionName,
JCO.Client connection) {
IRepository repository =
JCO.createRepository (repositoryName, connection);
IFunctionTemplate ft = repository.getFunctionTemplate (functionName);
return ft.getFunction ();
}
To create the Repository I pass an object of type JCO.Client. I have got
this object from a pool before.
When I understand the documentation corretly I can also pass the pool to
create a Repository. Then there wouldn't be no need to handle with
JCO.Client objects.
But I can not test this and thus I want ask if someone can confirm that
this works.
And another question: Since I don't need any Client objects then, I can
not release them to the pool. Is that ok and happens implicitely, or do
I have to do something else?
--
bye Armin
- 10
- >>>> Sr Java Dev position in MD -- $85/hr <<<<<Hello all!
I'm Anna Rocheva, a recruiter with USTAS Technologies. I'm glad to
present you a challenging opportunity.
Our direct client is a large reputed financial organization based in
Rockville MD, Washington DC Metro area. We are looking for Sr. Java
Engineer who will develop and support a mission-critical J2EE
applications.
Required skills:
?5-7 years of experience of
o OO design and development
o Hard-core Java development
?5-7 years of experience with the following technologies:
o Java (J2EE, Struts, tag library, Servlets, JSP)
o XML
o Web-based applications
o Ant
o SQL
o Oracle
o Unix/Linux
?2+ years of experience with the following technologies:
o Spring framework
o Hibernate
o AJAX
Agile software development practices
?Excellent communication and writing skills
?Product development methodologies
?Experience using software development best practices
?Experience using open source technologies
Compensation:
Up to $90/hr on c2c and $85/hr on w2..
We have outstanding benefits, e.g. 100% family medical insurance, 401K
plan, paid vacations etc.
If you think that the position requirements match your technical
background and expectations, don't hesitate to contact Anna at
301-242-5033 or via email: email***@***.com
- 11
- help with my first project on first job, how to read a strange file, thanks a lot!!!!!!!the OS is mainly windows. i doubt windows has powerful tool to do the
job automatically.
i need to open and close the file frequently because another process
is writing to the file. then Java create a new object each time I open
the file. in this case, can the program remeber the position I set
last time?
if yes, can i do the same thing with BufferedReader class instead of
RandomAccessFile. i am not sure whether RandomAccessFile can easily
allow me to keep the new line characters and white space among the
valid text. i need these chars in the application. The length() can
not help me a lot, since the file size does not change when new text
is written into the file. the new text write over the whitespace but
do not change the file size.
thanks again!
Alex Kizub <email***@***.com> wrote in message news:<email***@***.com>...
> You didn't mention OS. Probably it could be solved only by OS tools.
> For example for UNIX like it could be grep, tail -f, awk... |, >
>
> Java has other features, but since you can't change application and should
> only change the file (which is not good solution itself) here are some
> solutions for you.
>
> Use java.io.RandomAccessFile.
> So you can set position which you alreadu reached with method seek, you
> can know length of new open file with method
> length().
> Then, I suggest, read file with method read(byte[] b) copy none white
> spaces to another array and write it to the new file.
> Pretty easy.
>
> BTW. With java.io.File you can understand last modification time and
> decide do you need reread file again.
>
> Good luck in your new job.
> Alex Kizub.
> matt wrote:
>
> > Java guys:
> > this is my first project at my first job. so pls help if you could.
> > i am working with a text file with strange format. The file has a lot
> > of white space between the last line of valid text and the end of
> > file character. And the file is update frequently. New valid text is
> > appended behind the original valid text and overwrite some whitespace.
> > I need to feed this file as an input to an application. but this
> > application only take files without such whitespace. The application
> > need to read the file frequently to see whether new text is appended.
> > if there is, get the appended text.
> > My initial solution is to convert the original file into a new file in
> > which the whitespace is truncated. then the application can read the
> > new file.
> > possibility 1:
> > loop
> > read 1 line of text of original file
> > write this line to new file
> > until read the long line of white space
> > close both file
> >
> > in this case, what class and method should i use, especially in
> > examing the white spaces?
> >
> > possibility 2:
> > the previous one is not smart because the same text is read and write
> > each time when the file is read. so is there a way i can just each
> > time check whether update happens to the file and then just write the
> > update to the new file? such as in C, a file pointer know the position
> > of last read. can i do the same in Java or C#? or other ways to do it?
> > possibility 3:
> > very unlikely but smarter,
> > read the file in a stream, truncate the whitespace inside the
> > stream, then feed the stream directly into the application. but it is
> > unlikely because i can not change the souce code the application.
> >
> > any other possibilies to solve this problem?
> > for all the possibilities, pls tell me what class and method should i
> > use, sample code and website is extremely helpful.
> > thanks a lot!!!!!
- 12
- JavaMail GNUMail, Knife, Classpath and gnu.inetOk, here is the deal. I am trying to install a ready to go NNTP
provider for jmail. This lead me to the Knife project, which lead me to
GNU mail which lead me to Project classpath which has led me to a huge
patchwork of downloads.
Has anyone else tried to get this all working? I know for sure that the
code modules I downloaded are not compatible with eachother. One set of
code, for example, is calling on constructors and methods with wrong
method signatures.
Does anyone have something to say on this? Am I missing something? Open
Source is fairly good at avoiding this sort of thing, but then again...
<a href ="http://christian.bongiorno.org/resume.pdf">Christian
Bongiorno</a>
Come get me google!
- 13
- ImageIO.read(url)Hi,
I have an applet with this operation, from the Eclipse it is running without
problem.
When I upload to the web, I receive an "access denied".
Then I find that i need a signed applet. I signed the applet in a jar file,
and uploaded again.
The communication between java & javascript is working, but I continue
receiving the "access denied" error.
How can I set the security permissions to allow the applet to load the image
from an URL that is in another server ?
I need to use another object to read the image ?
Thanks to all.
- 14
- Read data from CSV FileHi all. I am currently trying to develop a program that will read data
from a CSV file which includes computer names that have been exported
from Active Directory. I want my java program to read in the CSV file
and get the data and place it into the JList.
Is this possible.
Any help in this matter would be highly appreciated.
Thank you
- 15
- jdk 1.5 on linuxHi.
Anybody tried jdk 1.5 on linux ?
I downloaded it, but I can't use any of new features.
Example : Generics
import java.util.*;
class test {
List<String> list = new ArrayList<String>();
}
this class compile fine on jdk 1.5 on Windows, but make on error on
linux :
> ./java -version
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)
> ./javac test.java
test.java:4: <identifier> expected
List<String> list = new ArrayList<String>();
^
1 error
on windows, java -version returns
C:\Documents and Settings\Mike>java -version
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode,
sharing)
I downloaded the 2 version (windows & linux) together.
Sun says that linux version is also a beta2 version but that's not
what "java -version" report.
So, anybody having the same problem or an idea on what happened ?
Thansk in advance.
Mike
|
|
|