sandyben 0 Newbie Poster
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.sql.*;



class transfer extends JFrame implements ActionListener
{
    JButton btntrans,btndel,btnexit,btnclear,btnone;
    ImageIcon bc;
    JLabel lbltitle ,label1;
    JTextField text1;
     JScrollPane scrollPane ;
     Thread t;
    DefaultListModel listModel;

     public transfer()
 
    {
 	
        setSize(550,400);
	setTitle(" FILE TRANSFER ");

	Container cp=getContentPane();
 
       lbltitle= new JLabel(bc);	
       label1 = new JLabel();
       label1.setFont(new Font("Serif", Font.PLAIN, 18));
       label1.setForeground(Color.black);
       label1.setOpaque(true);	
       label1.setText("Enter ip Address:");
	
        text1 = new JTextField(20);
       
        listModel = new DefaultListModel();
        JList list=new JList(listModel);
        scrollPane = new JScrollPane(list);
        scrollPane.getViewport().add(list);
        
        btntrans=new JButton(" ADD");
        btndel= new JButton("CLEAR ALL");
        btnone= new JButton(" DELETE ");
        btnexit=new JButton("EXIT");
        btnclear=new JButton("CLEAR"); 
        cp.setLayout(null); 
         /cp.setBackground(Color.white);
       Insets ins=getInsets();

	label1.setBounds(15,30,140,40);
        text1.setBounds(155,35,140,30);
	btntrans.setBounds(20,120,85,30);
        btnclear.setBounds(110,120,85,30);
        btnone.setBounds(200,120,85,30);
        list.setBounds(340,40,150,250);
        
        btndel.setBounds(50,170,100,30);
        btnexit.setBounds(160,170,100,30);
         bltitle.setBounds(0,0,850,570);
       //lbltitle.setBounds(220,20,130,104);

        btnclear.addActionListener(this);
        btnone.addActionListener(this);
	btntrans.addActionListener(this);
        btndel.addActionListener(this);
	btnexit.addActionListener(this);
        text1.addActionListener(this);
 
      cp.add(scrollPane,BorderLayout.CENTER);	
      cp.add(btntrans);
        cp.add(btndel);
        cp.add(btnone);
        cp.add(btnclear);
        cp.add(btnexit);
        cp.add(lbltitle);
        cp.add(label1);
        cp.add(text1);
        cp.add(list);

public static void main(String args[]) {
   transfer sl = new transfer();
    sl.setVisible(true);
  }

i just can't get the scroll bar for Jlist.. I tried almost evrythin possible..!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.