All pastes #918032 Raw Edit

mrcheeks

public java v1 · immutable
#918032 ·published 2008-02-25 21:11 UTC
rendered paste body
IRCWindowContainer iwc = SandIRCFrame.getInstance().getCurrentWindowContainer();         JPanel channelListPanel = new JPanel(new BorderLayout(3, 3));        Session session = iwc.getSession();         Vector columnNames = new Vector();        columnNames.add("Channel name");        columnNames.add("Users");        columnNames.add("Topic");        Vector data = new Vector();        List<Channel> channels = new ArrayList<Channel>(session.getChannels());        for (Channel channel : channels)        {            // see above - the loop            Vector row = new Vector();            row.add(channel.getName());            row.add("" + channel.getNicks().size());            row.add(channel.getTopic());            data.add(row);        }        DefaultTableModel channelListModel = new DefaultTableModel(data,                columnNames);        JTable channelListTable = new JTable(channelListModel);        JScrollPane channelListScrollPane = new JScrollPane();        channelListScrollPane.getViewport().add(channelListTable);        JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));        JButton refreshButton = new JButton("Refresh list");        JButton joinButton = new JButton("Join channel");        JButton saveListButton = new JButton("Save list");        buttonsPanel.add(refreshButton);        buttonsPanel.add(saveListButton);        buttonsPanel.add(joinButton);        channelListPanel.add(channelListScrollPane, BorderLayout.CENTER);        channelListPanel.add(buttonsPanel, BorderLayout.SOUTH);