package view;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Label;
import java.io.FileNotFoundException;
import java.util.Vector;
import javax.swing.JList;
import javax.swing.JPanel;
import control.DirectoryManager;
import entity.Directory;
import global.Constants;
public class Registration extends JPanel {
private static final long serialVersionUID = 1L;
private ControlPanel controlPanel;
private JPanel directoryPanel;
private DirectoryScrollPane campusScrollPane;
private DirectoryScrollPane collegeScrollPane;
private DirectoryScrollPane departmentScrollPane;
private Vector<String> strings;
private JList<String> list;
private DirectoryManager campusManager;
public Registration(int w, int h) {
this.setLayout(new BorderLayout());
this.controlPanel = new ControlPanel();
this.add(this.controlPanel, BorderLayout.NORTH);
this.directoryPanel = new JPanel();
this.add(this.directoryPanel, BorderLayout.CENTER);
this.directoryPanel.setLayout(new GridLayout(1,3));
{
this.campusScrollPane = new DirectoryScrollPane();
this.directoryPanel.add(this.campusScrollPane);
this.strings = new Vector<String>();
this.list = new JList<String>(this.strings);
this.setViewportView(this.list);
this.strings.add("ICT");
this.campusManager = new DirectoryManager();
this.selectCollege();
this.collegeScrollPane = new DirectoryScrollPane();
this.directoryPanel.add(this.collegeScrollPane);
this.departmentScrollPane = new DirectoryScrollPane();
this.directoryPanel.add(this.departmentScrollPane);
}
JPanel southPanel = new JPanel();
southPanel.setPreferredSize(new Dimension(w, 200));
this.add(southPanel, BorderLayout.SOUTH);
}
private void selectCollege() {
try {
Vector<Directory> directories = this.campusManager.getDirectories(Constants.FILE_SEOULCOLLEGELIST);
strings.clear();
for (Directory college: directories) {
strings.add(college.getName());
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void setViewportView(JList<String> list2) {
// TODO Auto-generated method stub
}
public void initialize() {
try {
this.campusScrollPane.showDirectories("root");
this.collegeScrollPane.showDirectories("seoul");
this.departmentScrollPane.showDirectories("generalS");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
커서에있는 스크롤패널에 문자열을 추가하고싶어서 파란색으로 넣었는데요.. 뜨지가않네요 ㅠㅠ 어떻게 스크롤페인 안에 문자열넣나요?
커서가 안보이네요 가장 왼쪽칸이요ㅠㅠ
걍 그 패널에 넣으면됨
고걸 어케 넣나요?? string을 add로 넣는거에여??ㅜ