Description:
This project is an online Chat Room System which is built in Java Swing. The system adopts 3 tier architecture in which the client request server to register itself to the room, server register’s the user to the room and finally the client can share content with other registered client via server.
The system allows the user to connect from different location in a common chat-room where they can broadcast text messages and share drawing with other registered users.
Features:
• Apart from sharing content, the server broadcast entry and exist of the user.
• The chat window of every user is registered with client specific Title.
• Messages from client are pre-pend with their name.
• Cosmetic color change is implemented on-hover, on-active on the chat window, its borders and buttons.
• System allows tracking the user who is currently present in the chat room.
• System has the feature to save text messages/history in a text file from the chat window to the client local system.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
Description:
This project is an online Chat Room System which is built in Java Swing. The system adopts 3 tier architecture in which the client request server to register itself to the room, server register’s the user to the room and finally the client can share content with other registered client via server.
The system allows the user to connect from different location in a common chat-room where they can broadcast text messages and share drawing with other registered users.
Features:
• Apart from sharing content, the server broadcast entry and exist of the user.
• The chat window of every user is registered with client specific Title.
• Messages from client are pre-pend with their name.
• Cosmetic color change is implemented on-hover, on-active on the chat window, its borders and buttons.
• System allows tracking the user who is currently present in the chat room.
• System has the feature to save text messages/history in a text file from the chat window to the client local system.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
Collections and its types in C# (with examples)Aijaz Ali Abro
Learn step by step c# collections with easy examples. Learn generic, non-generic and specialized collections along with easy and great examples. Learn about arraylist, queue class,stack class and more. Difference between generic and non-generic collections. Difference between arraylist and simple array.
Android Studio is a platform where you can create your own android based application for android based devices.
This presentation will show you the step by step procedure for downloading Android Studio, installing Android Studio, managing settings of Android Studio and creating new project in Android Studio
In Java 8, the java.util.function has numerous built-in interfaces. Other packages in the Java library (notably java.util.stream package) make use of the interfaces defined in this package. Java 8 developers should be familiar with using key interfaces provided in this package. This presentation provides an overview of four key functional interfaces (Consumer, Supplier, Function, and Predicate) provided in this package.
Presentation provides introduction and detailed explanation of the Java 8 Lambda and Streams. Lambda covers with Method references, default methods and Streams covers with stream operations,types of streams, collectors. Also streams are elaborated with parallel streams and benchmarking comparison of sequential and parallel streams.
Additional slides are covered with Optional, Splitators, certain projects based on lambda and streams
Data Persistence in Android with Room LibraryReinvently
Android developer Dmitry Dogar talks on how to organize data persistence in Android using the new Room library. Topic inspired by Google Developer Group meetup.
You are to simulate a dispatcher using a priority queue system in C+.pdfJUSTSTYLISH3B2MOHALI
You are to simulate a dispatcher using a priority queue system in C++. New processes are to be
entered using a GUI with priority included (numbering should be automatic). Processes are also
to be terminated by GUI command. Context switches are to be by command with the cause of the
switch being either a blocking call, time slice exceeded or termination. Assume only one CPU.
Priorities and numbers of processes can be kept small, just big enough to demonstrate the
required functionality. You may pre-populate the queues initially from a data file. I am looking
at the mechanism as you are NOT creating actual processes, just simulating them. Functionality
to be provided by you: 1. Priority based Ready Queue(s). 2. Blocked list. 3. Output of complete
system status after every context switch showing ready, blocked, and running processes.
Sample Output: A3 Antrian WAKTU TUN... TA1Telah diEksekusi Ambil No Antrian
Solution
//dispatcherSim.java
public class dispatcherSim {
public static void main(String[] args)
{
simulator sim=new simulator(1000);
sim.addProcessReady(1); //test data
sim.addProcessReady(3);
sim.addProcessReady(2);
sim.addProcessReady(7);
sim.addProcessReady(4);
sim.addProcessBlocked(1);
sim.addProcessBlocked(3);
sim.addProcessBlocked(2);
sim.addProcessBlocked(7);
sim.addProcessBlocked(4);
GUI gui=new GUI(sim);
gui.setVisible(true);
}
}
=====================================================================
=========
//GUI.java
import java.awt.BorderLayout;
import java.awt.Dialog.ModalityType;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class GUI extends JFrame {
private JPanel panel;
private JMenuBar menuBar;
private JMenu menu;
private JMenuItem addNew;
private JMenuItem unBlock;
private JMenuItem terminate;
private JMenuItem readMe;
private JMenuItem exit;
private JButton cSwitch;
private JTextArea info;
private JScrollPane scroll;
private simulator sim;
private final String CS = \"CONTEXT SWITCH: \";
private int count = 1;
public GUI(simulator disSim) {
sim = disSim;
initComponents();
}
private void addNewBox() {
final JDialog addDialog = new JDialog();
JPanel miniPanel = new JPanel(new BorderLayout());
miniPanel.setPreferredSize(new Dimension(175, 100));
ButtonGroup radioGroup = new ButtonGroup();
final JRadioButton blocked = new JRadioButton(\"Blocked List\");
final JRadioButton ready = new JRadioButton(\"Ready Queue\");
ready.setSelected(true);
radioGroup.add(ready);
radioGroup.add(blocked);
JPanel radios = new JPanel();
radios.setPreferredSize(new Dimension(50, 50));
.
Collections and its types in C# (with examples)Aijaz Ali Abro
Learn step by step c# collections with easy examples. Learn generic, non-generic and specialized collections along with easy and great examples. Learn about arraylist, queue class,stack class and more. Difference between generic and non-generic collections. Difference between arraylist and simple array.
Android Studio is a platform where you can create your own android based application for android based devices.
This presentation will show you the step by step procedure for downloading Android Studio, installing Android Studio, managing settings of Android Studio and creating new project in Android Studio
In Java 8, the java.util.function has numerous built-in interfaces. Other packages in the Java library (notably java.util.stream package) make use of the interfaces defined in this package. Java 8 developers should be familiar with using key interfaces provided in this package. This presentation provides an overview of four key functional interfaces (Consumer, Supplier, Function, and Predicate) provided in this package.
Presentation provides introduction and detailed explanation of the Java 8 Lambda and Streams. Lambda covers with Method references, default methods and Streams covers with stream operations,types of streams, collectors. Also streams are elaborated with parallel streams and benchmarking comparison of sequential and parallel streams.
Additional slides are covered with Optional, Splitators, certain projects based on lambda and streams
Data Persistence in Android with Room LibraryReinvently
Android developer Dmitry Dogar talks on how to organize data persistence in Android using the new Room library. Topic inspired by Google Developer Group meetup.
You are to simulate a dispatcher using a priority queue system in C+.pdfJUSTSTYLISH3B2MOHALI
You are to simulate a dispatcher using a priority queue system in C++. New processes are to be
entered using a GUI with priority included (numbering should be automatic). Processes are also
to be terminated by GUI command. Context switches are to be by command with the cause of the
switch being either a blocking call, time slice exceeded or termination. Assume only one CPU.
Priorities and numbers of processes can be kept small, just big enough to demonstrate the
required functionality. You may pre-populate the queues initially from a data file. I am looking
at the mechanism as you are NOT creating actual processes, just simulating them. Functionality
to be provided by you: 1. Priority based Ready Queue(s). 2. Blocked list. 3. Output of complete
system status after every context switch showing ready, blocked, and running processes.
Sample Output: A3 Antrian WAKTU TUN... TA1Telah diEksekusi Ambil No Antrian
Solution
//dispatcherSim.java
public class dispatcherSim {
public static void main(String[] args)
{
simulator sim=new simulator(1000);
sim.addProcessReady(1); //test data
sim.addProcessReady(3);
sim.addProcessReady(2);
sim.addProcessReady(7);
sim.addProcessReady(4);
sim.addProcessBlocked(1);
sim.addProcessBlocked(3);
sim.addProcessBlocked(2);
sim.addProcessBlocked(7);
sim.addProcessBlocked(4);
GUI gui=new GUI(sim);
gui.setVisible(true);
}
}
=====================================================================
=========
//GUI.java
import java.awt.BorderLayout;
import java.awt.Dialog.ModalityType;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class GUI extends JFrame {
private JPanel panel;
private JMenuBar menuBar;
private JMenu menu;
private JMenuItem addNew;
private JMenuItem unBlock;
private JMenuItem terminate;
private JMenuItem readMe;
private JMenuItem exit;
private JButton cSwitch;
private JTextArea info;
private JScrollPane scroll;
private simulator sim;
private final String CS = \"CONTEXT SWITCH: \";
private int count = 1;
public GUI(simulator disSim) {
sim = disSim;
initComponents();
}
private void addNewBox() {
final JDialog addDialog = new JDialog();
JPanel miniPanel = new JPanel(new BorderLayout());
miniPanel.setPreferredSize(new Dimension(175, 100));
ButtonGroup radioGroup = new ButtonGroup();
final JRadioButton blocked = new JRadioButton(\"Blocked List\");
final JRadioButton ready = new JRadioButton(\"Ready Queue\");
ready.setSelected(true);
radioGroup.add(ready);
radioGroup.add(blocked);
JPanel radios = new JPanel();
radios.setPreferredSize(new Dimension(50, 50));
.
Why following sort does not work (It does not sort last 2 - 3 numbe.pdfgopalk44
Why following sort does not work? (It does not sort last 2 - 3 numbers)
//Sort order
class SortNumbListener implements ActionListener
{
@Override
public void actionPerformed(ActionEvent e)
{
Collections.sort(list);
for(int i = 0; i < list.size(); i++)
{
textfield2.setText(list.toString());
}
System.out.print(list + \"\ \");
}
}
Solution
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.JTextField;
public class SorAction {
public JTextField textfield2;
public List list;
public SorAction() {
// TODO Auto-generated constructor stub
textfield2 = new JTextField();
list = new ArrayList();
list.add(20);
list.add(12);
list.add(32);
list.add(3);
new SortNumbListener().actionPerformed(new ActionEvent(\"\", 0, null));
}
public static void main(String[] args) {
try {
new SorAction();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
class SortNumbListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
Collections.sort(list);
textfield2.setText(list.toString());
System.out.print(list + \"\ \");
}
}
}
OUTPUT:
[3, 12, 20, 32]
NOTE: please check the above example, sorting fine, but what is the need of loop,
if you want to add the text to textbox use setText() method of textfield.
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmary772
CodeZip/ButtonDemo.javaCodeZip/ButtonDemo.java// Demonstrate a push button and handle action events.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassButtonDemoimplementsActionListener{
JLabel jlab;
JTextField jtf;
ButtonDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("A Button Example");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(220,90);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Make two buttons.
JButton jbtnUp =newJButton("Up");
JButton jbtnDown =newJButton("Down");
// Create a text field.
jtf =newJTextField(10);
// Add action listeners.
jbtnUp.addActionListener(this);
jbtnDown.addActionListener(this);
// Add the buttons to the content pane.
jfrm.add(jbtnUp);
jfrm.add(jbtnDown);
jfrm.add(jtf);
// Create a label.
jlab =newJLabel("Press a button.");
// Add the label to the frame.
jfrm.add(jlab);
// Display the frame.
jfrm.setVisible(true);
}
// Handle button events.
publicvoid actionPerformed(ActionEvent ae){
if(ae.getActionCommand().equals("Up")){
jlab.setText("You pressed Up.");
FileClock clock1=newFileClock(jtf);
Thread thread1=newThread(clock1);
thread1.start();
}
else
jlab.setText("You pressed down. ");
}
publicstaticvoid main(String args[]){
// Create the frame on the event dispatching thread.
SwingUtilities.invokeLater(newRunnable(){
publicvoid run(){
newButtonDemo();
}
});
}
}
CodeZip/CBDemo.javaCodeZip/CBDemo.java// Demonstrate check boxes.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassCBDemoimplementsItemListener{
JLabel jlabSelected;
JLabel jlabChanged;
JCheckBox jcbAlpha;
JCheckBox jcbBeta;
JCheckBox jcbGamma;
CBDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("Demonstrate Check Boxes");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(280,120);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create empty labels.
jlabSelected =newJLabel("");
jlabChanged =newJLabel("");
// Make check boxes.
jcbAlpha =newJCheckBox("Alpha");
jcbBeta =newJCheckBox("Beta");
jcbGamma =newJCheckBox("Gamma");
// Events generated by the check boxes
// are handled in common by the itemStateChanged()
// method implemented by CBDemo.
jcbAlpha.addItemListener(this);
jcbBeta.addItemListener(this);
jcbGamma.addItemListener(this);
// Add checkboxes and labels to the content pane.
jfrm.add(jcbAlpha);
jfrm.add(jcbBeta);
jfrm.add(jcbGamma);
jfrm.add(jlabChanged);
jfrm.add(jlabSelected);
// Display the frame.
jfrm.setVisible(true);
}
// This is the handler for the check boxes..
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmccormicknadine86
CodeZip/ButtonDemo.javaCodeZip/ButtonDemo.java// Demonstrate a push button and handle action events.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassButtonDemoimplementsActionListener{
JLabel jlab;
JTextField jtf;
ButtonDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("A Button Example");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(220,90);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Make two buttons.
JButton jbtnUp =newJButton("Up");
JButton jbtnDown =newJButton("Down");
// Create a text field.
jtf =newJTextField(10);
// Add action listeners.
jbtnUp.addActionListener(this);
jbtnDown.addActionListener(this);
// Add the buttons to the content pane.
jfrm.add(jbtnUp);
jfrm.add(jbtnDown);
jfrm.add(jtf);
// Create a label.
jlab =newJLabel("Press a button.");
// Add the label to the frame.
jfrm.add(jlab);
// Display the frame.
jfrm.setVisible(true);
}
// Handle button events.
publicvoid actionPerformed(ActionEvent ae){
if(ae.getActionCommand().equals("Up")){
jlab.setText("You pressed Up.");
FileClock clock1=newFileClock(jtf);
Thread thread1=newThread(clock1);
thread1.start();
}
else
jlab.setText("You pressed down. ");
}
publicstaticvoid main(String args[]){
// Create the frame on the event dispatching thread.
SwingUtilities.invokeLater(newRunnable(){
publicvoid run(){
newButtonDemo();
}
});
}
}
CodeZip/CBDemo.javaCodeZip/CBDemo.java// Demonstrate check boxes.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassCBDemoimplementsItemListener{
JLabel jlabSelected;
JLabel jlabChanged;
JCheckBox jcbAlpha;
JCheckBox jcbBeta;
JCheckBox jcbGamma;
CBDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("Demonstrate Check Boxes");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(280,120);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create empty labels.
jlabSelected =newJLabel("");
jlabChanged =newJLabel("");
// Make check boxes.
jcbAlpha =newJCheckBox("Alpha");
jcbBeta =newJCheckBox("Beta");
jcbGamma =newJCheckBox("Gamma");
// Events generated by the check boxes
// are handled in common by the itemStateChanged()
// method implemented by CBDemo.
jcbAlpha.addItemListener(this);
jcbBeta.addItemListener(this);
jcbGamma.addItemListener(this);
// Add checkboxes and labels to the content pane.
jfrm.add(jcbAlpha);
jfrm.add(jcbBeta);
jfrm.add(jcbGamma);
jfrm.add(jlabChanged);
jfrm.add(jlabSelected);
// Display the frame.
jfrm.setVisible(true);
}
// This is the handler for the check boxes. ...
PLEASE HELP ME !!IT IS Due Tonight ;(!i have to submit it before.pdfmohammedfootwear
PLEASE HELP ME !!
IT IS Due Tonight ;(!
i have to submit it before 12 palzz help me :\"\"(
How can I make the add button and remove button initialize button work?
For the buttons should add and remove to the JTextArea and JList.
when you write you use the JTextField to add or remove what you write in the JTextArea and
JList.
For the initialize, the button should initialize the text once.
Ihave three class.
this what I code so far:
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Image;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFileChooser;
import java.awt.Insets;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.SwingConstants;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.ImageIcon;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.logging.Handler;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Component;
import javax.swing.ButtonGroup;
import javax.swing.DropMode;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.MatteBorder;
import javax.swing.border.TitledBorder;
import javax.swing.UIManager;
import java.awt.FlowLayout;
public class Schedule extends JFrame implements ListSelectionListener, ActionListener {
private ScheduleTextArea STArea;
private ScheduleButton SButton;
private JRadioButtonMenuItem BRed;
private JRadioButtonMenuItem BBlue;
private JRadioButtonMenuItem BGreen;
private JRadioButtonMenuItem BYellow;
private JPanel cntrolPanel;
public static void main(String[] args){
Schedule S= new Schedule();
S.setVisible(true);
}
public Schedule() {
setTitle(\"Student schedule\");
setSize(800,700);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new GridLayout(0, 1, 0, 0));
createMenuBar();
cntrolPanel= new JPanel();
cntrolPanel.setBorder(new MatteBorder(3, 3, 3, 3, (Color) Color.GRAY));
getContentPane().add(cntrolPanel);
cntrolPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
STArea = new ScheduleTextArea();
STArea.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(128, 128, 128)));
cntrolPanel.add(STArea);
SButton = new ScheduleButton(null);
SButton.setBorder(new MatteBorder(1, 1, 1, 1, (Color) Color.GRAY));
cntrolPanel.add(SButton);
}
private void createMenuBar() {
BHandler handler = new BHandler();
JMenuBar menuBar= new JMenuBar();
setJ.
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
public class Lab2 extends JFrame implements ActionListener {
JButton open = new JButton("Next Program");
JTextArea result = new JTextArea(20,40);
JLabel errors = new JLabel();
JScrollPane scroller = new JScrollPane();
public Lab2() {
setLayout(new java.awt.FlowLayout());
setSize(500,430);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
add(open); open.addActionListener(this);
scroller.getViewport().add(result);
add(scroller);
add(errors);
}
public void actionPerformed(ActionEvent evt) {
result.setText(""); //clear TextArea for next program
errors.setText("");
processProgram();
}
public static void main(String[] args) {
Lab2 display = new Lab2();
display.setVisible(true);
}
String getFileName() {
JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION)
return fc.getSelectedFile().getPath();
else
return null;
}
/************************************************************************/
/* Put your implementation of the processProgram method here. */
/* Use the getFileName method to allow the user to select a program. */
/* Then simulate the execution of that program. */
/* You may add any other methods that you think are appropriate. */
/* However, you should not change anything in the code that I have */
/* written. */
/************************************************************************/
public void processProgram(){
final String filename = getFileName();
this.result.setText("");
if (filename == null){
return;
}
}
public void doStmt(String stmt){
}
}
Also, error checking is required..
I am getting a syntax error. I cant seem to find whats causing t.pdffashionfolionr
I am getting a syntax error. I can\'t seem to find what\'s causing this progrm even though I correct
what it\'s asking me to do. It seems to add even more errors.
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
public class GUI extends JFrame {
// create required GUI radios, labels, textfields and buttons
private JRadioButton iterative;
private JRadioButton recursive;
private JLabel entern;
private JLabel result;
private JLabel efficiency;
private JTextField t1;
private JTextField t2;
private JTextField t3;
private JButton compute;
private ButtonGroup radios = new ButtonGroup();
private ButtonGroup candidates = new ButtonGroup();
// create constructor for GUI
public GUI(){
super(\"Project 3\");
setLayout (new GridLayout(6,2));
setSize(275,250);
// initializing buttons and etc and adding them
iterative = new JRadioButton(\"Iterative\");
add(iterative);
recursive = new JRadioButton(\"Recursive\");
add(recursive);
// add radiobuttons to group so only one selection is possible
radios.add(iterative);
radios.add(recursive);
entern = new JLabel(\"Enter n:\");
add(entern);
result = new JLabel(\"Result:\");
add(result);
efficiency = new JLabel(\"Efficiency:\");
add(efficiency);
t1 = new JTextField();
add(t1);
compute = new JButton(\"Compute\");
add(compute);
t2 = new JTextField();
add(t2);
t3 = new JTextField();
add(t3);
/*
thehandler handler = new thehandler();
iterative.addActionListener(handler);
recursive.addActionListener(handler);
compute.addActionListener(handler);
****************************/
compute.addActionListener(new ActionListener (){
public void actionPerformed(ActionEvent b){
computeactionPerformed(b);
private void computeactionPerformed(ActionEvent b){
if ((iterative.isSelected(true))){
JOptionPane.showMessageDialog(null,\"you chose iterative\");
}
else if (recursive.isSelected(true)){
JOptionPane.showMessageDialog(null,\"you chose recursive\");
}
}
}
});
// create sub-panel for radio buttons
JPanel radioPanel = new JPanel();
radioPanel.add(iterative);
radioPanel.add(recursive);
/*
class thehandler implements ActionListener{
public void actionPerformed(ActionEvent e) {
if(e.getSource()==iterative && e.getSource()==compute){
System.out.println(\"you chose iterative\");
}
else if(e.getSource()==recursive && e.getSource()==compute){
System.out.println(\"you chose recursive\");
}
}
}
******************************/
}
public static void main(String[]args){
GUI object = new GUI();
object.setVisible(true);
object.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Solution
I have Change in code . No it\'s working without any compliantion error.
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.
I have done it under neatbeans IDE and just added ToggleGroup for gr.pdfannaimobiles
I have done it under neatbeans IDE and just added ToggleGroup for grouping radion buttons
inorder to select one at time.
package tempconverter;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Tempconverter extends Application {
/**
* @param args the command line arguments executes project
*/
final ToggleGroup group1 = new ToggleGroup();
final ToggleGroup group2 = new ToggleGroup();
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
BorderPane pane = new BorderPane(); //the big picture
BorderPane p1 = new BorderPane();//top
BorderPane p2 = new BorderPane(); //bottom
Label temp = new Label(\"Enter a temperature\"); //enter temp label
Label convertTemp = new Label(\"Converted temperature\"); //converted temp label
Label input = new Label(\"Input Scale\");//input scale label
Label output = new Label(\"Output Scale\");//Output Scale label
TextField tempText = new TextField(); //text field to enter temp
TextField convertText = new TextField(); //output textfield for the converted temp
VBox scaleIn = new VBox(15);
VBox scaleOut = new VBox(15);
RadioButton c = new RadioButton(\"celcius\"); //button for celcius on input side
c.setToggleGroup(group1);
RadioButton f = new RadioButton(\"Fahrenheit\");//button for Fahrenheit on input side
f.setToggleGroup(group1);
RadioButton k = new RadioButton(\"kelvin\");//button for kelvin on inputside
k.setToggleGroup(group1);
RadioButton c1 = new RadioButton(\"celcius\");//button for celcius on outputside
c1.setToggleGroup(group2);
RadioButton f1 = new RadioButton(\"Fahrenheit\"); //button for f on output side
f1.setToggleGroup(group2);
RadioButton k1 = new RadioButton(\"kelvin\"); //button for kelvin on output side
k1.setToggleGroup(group2);
p1.setStyle(\"-fx-border-color:red\"); //set top border pane to red
p1.setRight(tempText);
p1.setLeft(temp);
pane.setTop(p1);
pane.setBottom(p2);
p2.setLeft(convertTemp);
p2.setRight(convertText);
p2.setStyle(\"-fx-border-color:red\");
input.setPrefWidth(100);
output.setPrefWidth(100);
c.setPrefWidth(100);
f.setPrefWidth(100);
k.setPrefWidth(100);
c1.setPrefWidth(100);
f1.setPrefWidth(100);
k1.setPrefWidth(100);
scaleIn.setStyle(\"-fx-border-color:red\");
scaleIn.getChildren().addAll(input, c, f, k);
scaleIn.setAlignment(Pos.CENTER);
pane.setLeft(scaleIn);
TextArea.
Similar to Chat application in java using swing and socket programming. (20)
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Chat application in java using swing and socket programming.
1. Firstly run myserver.java then run login.java
//Login page
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
// Login class which takes a user name and passed it to client class
public class Login implements ActionListener{
JFrame frame1;
JTextField tf;
JButton button;
JLabel heading;
JLabel label;
public static void main(String[] args){
new Login();
}
public Login(){
frame1 = new JFrame("Login Page");
tf=new JTextField();
button=new JButton("Login");
heading=new JLabel("Chat Server");
2. heading.setFont(new Font("Impact", Font.BOLD,40));
label=new JLabel("Enter you Login Name");
label.setFont(new Font("Serif", Font.PLAIN, 24));
JPanel panel = new JPanel();
button.addActionListener(this);
panel.add(heading);panel.add(tf);panel.add(label);
panel.add(button);
heading.setBounds(30,20,280,80);
label.setBounds(20,100,250,60);
tf.setBounds(50,150,150,30);
button.setBounds(70,200,90,30);
frame1.add(panel);
panel.setLayout(null);
frame1.setSize(300, 300);
frame1.setVisible(true);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
// pass the user name to MyClient class
public void actionPerformed(ActionEvent e){
String name="";
try{
name=tf.getText();
frame1.dispose();
MyClient mc=new MyClient(name);
4. s2=ss.accept();
al.add(s); // add the client socket in arraylist
al1.add(s1);
al2.add(s2);
System.out.println("Client is Connected");
MyThread2 m=new MyThread2(s2,al2,alname); //new thread
for maintaning the list of user name
Thread t2=new Thread(m);
t2.start();
MyThread r=new MyThread(s,al);//new thread for receive and
sending the messages
Thread t=new Thread(r);
t.start();
MyThread1 my=new MyThread1(s1,al1,s,s2); // new thread for
update the list of user name
Thread t1=new Thread(my);
t1.start();
}
}
public static void main(String[] args){
try{
new MyServer();
}catch (IOException e){}
5. }
}
//class is used to update the list of user name
class MyThread1 implements Runnable{
Socket s1,s,s2;
static ArrayList al1;
DataInputStream ddin;
String sname;
MyThread1(Socket s1,ArrayList al1,Socket s,Socket s2){
this.s1=s1;
this.al1=al1;
this.s=s;
this.s2=s2;
}
public void run(){
try{
ddin=new DataInputStream(s1.getInputStream());
while(true){
sname=ddin.readUTF();
System.out.println("Exit :"+sname);
MyThread2.alname.remove(sname);//remove the logout user name
from arraylist
MyThread2.every();
al1.remove(s1);
MyThread.al.remove(s);
6. MyThread2.al2.remove(s2);
if(al1.isEmpty())
System.exit(0); //all client has been logout
}
}catch(Exception ie){}
}
}
// class is used to maintain the list of all online users
class MyThread2 implements Runnable{
Socket s2;
static ArrayList al2;
static ArrayList alname;
static DataInputStream din1;
static DataOutputStream dout1;
MyThread2(Socket s2,ArrayList al2,ArrayList alname){
this.s2=s2;
this.al2=al2;
this.alname=alname;
}
public void run(){
try{
din1= new DataInputStream(s2.getInputStream());
7. alname.add(din1.readUTF()); // store the user name in arraylist
every();
}catch(Exception oe){System.out.println("Main expression"+oe);}
}
// send the list of user name to all client
static void every()throws Exception{
Iterator i1=al2.iterator();
Socket st1;
while(i1.hasNext()){
st1=(Socket)i1.next();
dout1=new DataOutputStream(st1.getOutputStream());
ObjectOutputStream obj=new ObjectOutputStream(dout1);
obj.writeObject(alname); //write the list of users in stream of
all clients
dout1.flush();
obj.flush();
}
}
}
//class is used to receive the message and send it to all clients
class MyThread implements Runnable{
Socket s;
static ArrayList al;
DataInputStream din;
8. DataOutputStream dout;
MyThread(Socket s, ArrayList al){
this.s=s;
this.al=al;
}
public void run(){
String str;
int i=1;
try{
din=new DataInputStream(s.getInputStream());
}catch(Exception e){}
while(i==1){
try{
str=din.readUTF(); //read the message
distribute(str);
}catch (IOException e){}
}
}
// send it to all clients
public void distribute(String str)throws IOException{
Iterator i=al.iterator();
13. s1=new Socket("localhost",1004);
s2=new Socket("localhost",1004);
//create inputstream for a particular socket
din=new DataInputStream(s.getInputStream());
//create outputstream
dout=new DataOutputStream(s.getOutputStream());
//sending a message for login
dout.writeUTF(name+" has Logged in");
dlout=new DataOutputStream(s1.getOutputStream());
dout1=new DataOutputStream(s2.getOutputStream());
din1=new DataInputStream(s2.getInputStream());
// creating a thread for maintaning the list of user name
My1 m1=new My1(dout1,model1,name,din1);
Thread t1=new Thread(m1);
t1.start();
//creating a thread for receiving a messages
My m=new My(din,model);
Thread t=new Thread(m);
t.start();
}
public void actionPerformed(ActionEvent e){
// sending the messages
if(e.getSource()==button){
14. String str="";
str=tf.getText();
tf.setText("");
str=name+": > "+str;
try{
dout.writeUTF(str);
//System.out.println(str);
dout.flush();
}catch(IOException ae){System.out.println(ae);}
}
// client logout
if (e.getSource()==lout){
frame.dispose();
//new Welcome();
JOptionPane.showMessageDialog(null,"Return Back to
Welcome page");
try{
//sending the message for logout
dout.writeUTF(name+" has Logged out");
dlout.writeUTF(name);
dlout.flush();
Thread.currentThread().sleep(1000);
System.exit(1);
}catch(Exception oe){}
}
15. }
public void windowClosing(WindowEvent w){
try{
dlout.writeUTF(name);
dlout.flush();
Thread.currentThread().sleep(1000);
System.exit(1);
}catch(Exception oe){}
}
}
// class is used to maintaning the list of user name
class My1 implements Runnable{
DataOutputStream dout1;
DefaultListModel model1;
DataInputStream din1;
String name,lname;
ArrayList alname=new ArrayList(); //stores the list of user names
ObjectInputStream obj; // read the list of user names
int i=0;
My1(DataOutputStream dout1,DefaultListModel model1,String
name,DataInputStream din1){
this.dout1=dout1;
this.model1=model1;
this.name=name;
16. this.din1=din1;
}
public void run(){
try{
dout1.writeUTF(name); // write the user name in output stream
while(true){
obj=new ObjectInputStream(din1);
//read the list of user names
alname=(ArrayList)obj.readObject();
if(i>0)
model1.clear();
Iterator i1=alname.iterator();
System.out.println(alname);
while(i1.hasNext()){
lname=(String)i1.next();
i++;
//add the user names in list box
model1.addElement(lname);
}
}
}catch(Exception oe){}
}
}
//class is used to received the messages
17. class My implements Runnable{
DataInputStream din;
DefaultListModel model;
My(DataInputStream din, DefaultListModel model){
this.din=din;
this.model=model;
}
public void run(){
String str1="";
while(true){
try{
str1=din.readUTF(); // receive the message
// add the message in list box
model.addElement(str1);
}catch(Exception e){}
}
}
}