GWindow ‘g4p’ / Draws incorrectly. (Windows ‘new window’ problem)
- Please check 2 images.
- If it is drawn correctly, if it is drawn incorrectly
- Draw stops after 1 operation with ‘noLoop’.
- Is there a way to increase the probability (accuracy) of drawing correctly?
import g4p_controls.*;
ArrayList<GWindow> windowsList;
GWindow window_cycle_list;
void WIN_SETUP_cyclist(int w_x, int w_y){
//------------------------------------------------------//
windowsList = G4P.getOpenWindowsAsList(windowsList);
if(windowsList.contains(window_cycle_list)){ window_cycle_list.close(); return;}
//------------------------------------------------------//
//------------------------------------------------------//
window_cycle_list = GWindow.getWindow(this, "Cycle List", w_x, w_y, 600, 300, JAVA2D);
window_cycle_list.setActionOnClose(window_cycle_list.CLOSE_WINDOW);
//------------------------------------------------------//
//------------------------------------------------------//
window_cycle_list.setAlwaysOnTop(true); window_cycle_list.addDrawHandler(this, "windowLIST"); window_cycle_list.addMouseHandler(this, "windowMouse_LIST");
window_cycle_list.textFont(myFont_N); window_cycle_list.imageMode(CENTER); window_cycle_list.textAlign(CENTER); window_cycle_list.frameRate(1);
window_cycle_list.background(255);
window_cycle_list.rectMode(CENTER);
//------------------------------------------------------//
}
public void windowLIST(PApplet appc, GWinData data) {
int g_x=0,g_y=0,g_w=0,g_h=0,g_w2=0,g_h2=0;
int g_c=350;
int g_c_y=250;
int g_x1=110, g_x2=330, g_x3=515;
appc.background(255); appc.textAlign(CENTER,CENTER);
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
g_y=40; g_h2=18;
boolean i_n = true; appc.noStroke();
for (int i = 0; i < 16; i++){
if(i==0){ appc.fill(0,112,192); }
else{
if(i_n){i_n=false; appc.fill(255); }
else{i_n=true; appc.fill(218,227,243); }
}
appc.rect(300,g_y+i*g_h2,600,g_h2);
}
appc.stroke(255); appc.strokeWeight(2);
appc.line(220,0,220,600); appc.line(440,0,440,600);
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
g_y=36;appc.textSize(16);
appc.text("Start Date/Time",g_x1,g_y); appc.text("End Date/Time",g_x2,g_y); appc.text("Log",g_x3,g_y);
appc.fill(30); g_y=55; appc.textSize(12);
for (int i = 0; i < 15; i++){
appc.text(HISTORY_CYCLE[i][0],g_x1,g_y+round(g_h2*(i)));
appc.text(HISTORY_CYCLE[i][1],g_x2,g_y+round(g_h2*(i)));
appc.text(HISTORY_CYCLE[i][2],g_x3,g_y+round(g_h2*(i)));
}
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
g_x=530; g_y=12; g_w=125; g_w2=135; g_h=26;
appc.fill(10);
appc.rect(g_x,g_y,g_w,g_h,30);
appc.fill(255); appc.textSize(15); appc.textAlign(CENTER,CENTER);
appc.text("EXIT",g_x,g_y-3);
//----------------------------------------------------------------------------//
appc.noLoop();
return;
}