/** * Position the component of the GUI. * * <p>Currently use absolute positioning to gather most of the component in the top-left corner. */ private void setLayout() { // Set the globe to use the full space available ping_globe.setBounds(0, 0, applet.getWidth(), applet.getHeight()); // First raw of display Dimension name_size = nickname_field.getPreferredSize(); Dimension update_name_size = rename_button.getPreferredSize(); Dimension client_info_size = client_info_display.getPreferredSize(); int row_height = name_size.height; nickname_field.setBounds(5, 5, name_size.width, row_height); rename_button.setBounds(8 + name_size.width, 5, update_name_size.width, row_height); client_info_display.setBounds( 11 + name_size.width + update_name_size.width, 5, client_info_size.width, row_height); // Second raw of display Dimension counter_size = pings_counter_display.getPreferredSize(); Dimension pause_size = pause_button.getMinimumSize(); pings_counter_display.setBounds(5, 8 + row_height, counter_size.width, row_height); pause_button.setBounds(8 + counter_size.width, 8 + row_height, pause_size.width, row_height); }
private void updateClientInfoDisplay(String ip_adress, GeoipInfo client_info) { String info_str = ": " + ip_adress + " "; if (client_info.city != null && !client_info.city.equals("")) info_str += client_info.city + ", "; info_str += client_info.country; client_info_display.setText(info_str); ping_globe.setOrigin(client_info); setLayout(); applet.repaint(); }