📄 ratingscalepanel.java
字号:
package abchr.gui.modulecontrols;
import abchr.ProjectModule;
import abchr.RatingScaleModule;
import javax.swing.*;
import java.awt.*;
public class RatingScalePanel extends JPanel implements ModuleControl {
private JTextArea textArea;
public RatingScalePanel(RatingScaleModule module) {
super(new BorderLayout());
textArea=new JTextArea("");
textArea.setPreferredSize(new Dimension(110,200));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setEditable(false);
textArea.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
textArea.setBackground(this.getBackground());
this.add(textArea,BorderLayout.CENTER);
setModule(module);
}
public RatingScalePanel(){this(null);}
public void setModule(ProjectModule module) {
if(module==null) {
textArea.setText("");
} else {
StringBuffer ratingsText=new StringBuffer("Ratings: \n\n\n");
for(int i=4;i>=0;i--) {
ratingsText.append(i+1);
ratingsText.append(".0 = ");
ratingsText.append(((RatingScaleModule)module).getRatingScaleLabel(i));
ratingsText.append("\n\n");
}
textArea.setText(ratingsText.toString());
textArea.setPreferredSize(new Dimension(120,200));
this.setPreferredSize(new Dimension(120,200));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -