I made a simple program in Processing, and it works great. Im now attempting to bring my beginner Java skills to Eclipse to make the same program over again. The program takes a Rs232 string that comes from the Com port and sends it over Xmpp.
The issue I'm having is that i cant call
newChat.sendMessage(message) like i can in processing from any of the Classes/Tabs. Can someone clue me in to what i should look for to fix this issue. I'm guessing Extending, or implementing the Xmpp class is what i need to do. I love how simple processing handles it..
Any help will be greatly appreciated.
Fyi: the Smack library's are in the code folder for processing.
Main Application:
import processing.net.*;
void setup() {
size(400, 200);
noStroke();
background(0);
LoadSerialPort();
OpenChatConnection();
setupFilterThread ();
}
void draw() {
}
String timestampTime() {
Calendar now = Calendar.getInstance();
return String.format("%1$tH:%1$tM:%1$tS", now);
}
String timestampDate() {
Calendar now = Calendar.getInstance();
return String.format("%1$tm/%1$td/%1$tY", now);
}
Filter Class:
FilterThread thread1;
List FilteredArchAddressList = new ArrayList();
ArrayList CallList = new ArrayList();
void setupFilterThread () {
thread1 = new FilterThread(100, "a");
thread1.start();
}
void checkForNewCalls() {
if (CallList.size() >=1) {
println("New Call In List, Size: "+CallList.size());
FilterComPortString((String) CallList.get(0));
CallList.remove(0);
}
}
void FilterComPortString(String s) {
Message message = new Message("icu1@broadcast.server", Message.Type.normal);
I am trying to make a List View similar to Androids, in standard processing, and have a skeleton started. But i have no clue on how to code the methods so that i could add and remove the items. Has this been done before? Maybe a library could help me... If anyone has any opinions, please post them...Thanks
PApplet app = this;
SideList Sl;
int ListLocation;
void setup() {
size(250, 800);
ListLocation = 0;
Sl = new SideList(ListLocation);
}
void draw() {
}
int ItemTally = 0;
public class SideList {
ArrayList Items = new ArrayList();
int itemHeight = 50;
int X;
SideList(int x) {
X=x;
Items.add( new SideListItem("Front", "Light Detection", X, Items.size()*(itemHeight+1), itemHeight));
Items.add( new SideListItem("Front", "Light Detection", X, Items.size()*(itemHeight+1), itemHeight));
Items.add( new SideListItem("Left", "Light Detection", X, Items.size()*(itemHeight+1), itemHeight));
app.registerDraw(this);
}
void setItemHeight(int i) {
itemHeight = i;
}
void draw() {
fill(100);
noStroke();
rect(X, 0, 250, height);
for (int i=0; i<Items.size(); i++) {
SideListItem Item = (SideListItem) Items.get(i);
Item.display();
}
fill(0);
rect(X, height-40, 250, 40);
textAlign(LEFT, TOP);
fill(255);
textSize(30);
text(timestampTime(), X+10, height-40);
}
}
public class SideListItem {
int I, X, Y, height;
int ID;
String Location, Info;
SideListItem(String loc, String info, int x, int y, int h) {
X=x;
Y=y;
height=h;
Location = loc;
Info = info;
println("Built SideList ITEM: "+ I +" @"+X+","+Y );
How would i make an indicator that serial is received, like a rect() that changes between red and green? I understand that serial data is transferred so quick that the color change would be unnoticeable, so there would need to be a >1 second hold on the color switch. Has anyone did this before? Any examples?
i have a device that outputs serial data like a string, and ends with 0D then 0A(ASCII:Linefeed then Carriage Return). When using the code below, it seems to be ignoring them and never prints a line or outputs. Hyper-terminal Reads the data fine.
Ive attempted on making the Mouse Functions Example work with a quadrilateral or a circle and I just Fail. I'm trying to make an object that can be resized and moved in the app. If i could get a circle to work I would just make the
quadrilaterals corners x and y coordinates the center of 4 circles.
Has any one ever done this before? Or can some one get me on the right path to make circles work.
Im a noob to programming anything, so here it goes.... Im attempting to display the last 10 entries of a column in a database table. I need the text to display in a list in the app window. Im getting stuck on the part after Line31, I dont have any idea on how to populate a List with the data queried. After mousePressed the list needs to update to redisplay the latest 10 element query.
The code i have below only shows the last line recieved, where i need to show all lines.
the data base is simple:
Column 1 my KEY, and is a Int, Primary Key that Auto increments with new line added.
Column 2 is ColString, and is text.
Data: with the "|" as the separator between column 1 and 2
1 | DATALINE1
2 | DATALINE2
3 | DATALINE3
4 | DATALINE4
5 | DATALINE5
6 | DATALINE6
import de.bezier.data.sql.*;
SQLite db;
void setup()
{
size( 500, 200 );
db = new SQLite( this, "test.db" ); // open database file
if ( db.connect() )
{
// list table names
db.query( "SELECT name as \"Name\" FROM SQLITE_MASTER where type=\"table\"" );
while (db.next())
{
println( db.getString("Name"));
}
// read all in table "table_one"
}
}
void draw() {
// text(DbRead, 10,10);
}
void mousePressed()
{
db.query( "SELECT ColString,KEY FROM SystemRead ORDER BY KEY Desc LIMIT 10" );