Up |
|
|
  |
Author: Manuel BlanquettManuel Blanquett
Date: Jul 18, 2008 16:27
Hello dear community,
after (countless) hours of systematic searching the endless worlds of
the internet, I still have not found a solution for my silly problem.
I use a JTextPane to display the output of a little cross-platform chat
protocol. The socket's input and output reader are set to receive/send
UTF-8:
BufferedReader in = new BufferedReader(new
InputStreamReader(client.getInputStream (), "UTF-8"));
and
OutputStreamWriter out = new OutputStreamWriter (client.getOutputStream
(), "UTF-8");
The String that I receive contains a base64 encoded chat message. After
decoding this message, it will be added to the JTextPane with the
following commands:
SimpleAttributeSet attr_default = new SimpleAttributeSet ();
StyleConstants.setFontFamily(attr_default, Font.MONOSPACED);
StyleConstants.setFontSize(attr_default, 12);
outputDocument.insertString (outputDocument.getLength (), message +
"\n", attr_default);
|
| Show full article (1.13Kb) |
|
| |
3 Comments |
|
  |
Author: Daniel MoyneDaniel Moyne
Date: Jul 18, 2008 06:33
This question is really generic ; I know how to read information from a
file ; from this file I want to display built object that I will name in
this post "record" ; so I will have a class "Record" ; so it will be
something like this :
for (from beginning to the end of text file) {
(a) gathering of "data" from file for generic record;
(b) Record record(i) = new Record(data);
(c) addition of record(i) into panel for display;
i+=1;
}
I know ho to handle (a) and (c) but how to create my collection of objects
record(i) (meaning name of instance to be changed at each i iteration) as
the name of an object is supposed to be "fixed" ; I have the strong feeling
that my question is entirely ridiculous but I have to go to the bottom of
it.
Thanks.
|
| |
|
| |
6 Comments |
|
  |
|
|
  |
Author: woody79woody79
Date: Jul 17, 2008 05:45
I have already written an autotalker in C#. But a friend asked me to
make one for Mac so I decided to do it in Java. I can't even work out
the error. Can someone please tell me how to fix this.
Here is my code:
package messengerspam;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.*;
import java.io.BufferedReader;
public class Main {
public static int keyInput[];
public static void main(String[] args) throws
AWTException,IOException {
InputStreamReader isr = new InputStreamReader( System.in );
BufferedReader stdin = new BufferedReader( isr );
String input = stdin.readLine();
char[] splitin = input.toCharArray();
|
| Show full article (1.17Kb) |
|
no comments
|
|
  |
Author: MReMRe
Date: Jul 17, 2008 04:44
Hi,
[short]
Is it possible, in a Java program, to get the complete command
string that was used to start that program?
[long]
With a Java program like..
// Test.java
public class Test
{ public static void main(String[] args)
{ System.out.println("Complete args: " + getCompleteArgs());
}
private static String getCompleteArgs()
{ // TODO - what goes here?
}
}
..that was run in a CLI as..
> java -Djava.library.path=x -cp y;z.jar Test -a -b
..it would output..
Complete args: java -Djava.library.path=x -cp y;z.jar Test -a -b
|
| Show full article (1.10Kb) |
|
5 Comments |
|
  |
Author: Dr. HackenbushDr. Hackenbush
Date: Jul 16, 2008 00:35
hi there im trying to run a script that performs some actions in Adobe
Photoshop and each time i run it i get the following error message
Error 2: self is undefined
Line:48
-> if(typeof(self.ywzXinited)=="undefined"){
i have no idea at all about scripting java i just want to run this script,
is anybody able to let me know what the problem is please.
If needed i can post the complete script.
many thanks
|
| |
|
no comments
|
|
  |
Author: villumanativillumanati
Date: Jul 15, 2008 06:12
I am looking for a site where programming assignments are given and
with the intent of the user going off and practicing developing java
code. Does anyone know of any sites.
Thanks in advance!
|
| |
|
no comments
|
|
  |
Author: Knute JohnsonKnute Johnson
Date: Jul 14, 2008 23:04
Is there a way to get multiple capturing groups without having multiple
sets of parenthesis?
"ABCDEFGHIJKL"
Regex "(\\w{3})" will match 3 letters
"(\\w{3}){4}" will match all four sets of three letters but there will
be only one capturing group.
Is there a way to get multiple capturing groups without doing
"(\\w{3})(\\w{3})(\\w{3})(\\w{3})"?
Thanks,
--
Knute Johnson
email s/nospam/knute2008/
|
| |
|
4 Comments |
|
  |
Author: Knute JohnsonKnute Johnson
Date: Jul 14, 2008 12:00
I've got a complicated pattern that I have to parse and was trying to
figure out if I could do it with a regex. I'm hoping some of the regex
experts here can help.
| | | | | | | | | | | |
RFO012010302ABCDEF01ghi02stuvwx
Fields that I need to match;
RFO - text field
012 - text field
01 - text field
03 - count of fields to follow
02 - number of subfields
ABC - first subfield
DEF - second subfield
01 - number of subfields
ghi - subfield
02 - number of subfields
stu - first subfield
vwx - second subfield
The field count can vary as well as the subfield counts.
|
| Show full article (1.19Kb) |
|
5 Comments |
|
  |
|
|
  |
Author: xareonxareon
Date: Jul 14, 2008 09:55
hi all, i got this slight problem. i have some instances of objects
from two classes, say Obj1 and Obj2 with their methods method1() and
method2(). let's say i have different instancs of Obj1 and only one of
Obj2: i have to implement a behaivour like this:
public void method1() // of the class Obj1
{
//do something
// stop the execution of the code of this method of the Obj1 and save
its state (it would be, the "line" of code till i have executed the
code) in a static common list
// do something else
//resume the execution of a stopped method2() of an Obj2 that's surely
in the list after having resumed this method
// re-execute method1() after a certain (variable) amount of time
}
public void method2() // of the class Obj2
{
//do something else
|
| Show full article (2.03Kb) |
|
no comments
|
|
|
|
|
|