You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
package com.fr.password.tool.ui; |
|
|
|
import javax.swing.*; |
|
import java.awt.*; |
|
|
|
public class TextPanel extends JPanel { |
|
public final static TextPanel INSTANCE = new TextPanel(); |
|
|
|
private JTextArea leftTextArea = new JTextArea(); |
|
private JTextArea rightTextArea = new JTextArea(); |
|
|
|
public TextPanel() { |
|
FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT); |
|
flowLayout.setVgap(FrameConstants.CHOICE_FLOW_WIDTH); |
|
setLayout(flowLayout); |
|
|
|
JScrollPane leftJScrollPane = new JScrollPane(leftTextArea); |
|
JScrollPane rightJScrollPane = new JScrollPane(rightTextArea); |
|
leftTextArea.setColumns(FrameConstants.TEXT_AREA_WIDTH); |
|
leftTextArea.setRows(FrameConstants.TEXT_AREA_HEIGHT); |
|
rightTextArea.setColumns(FrameConstants.TEXT_AREA_WIDTH); |
|
rightTextArea.setRows(FrameConstants.TEXT_AREA_HEIGHT); |
|
|
|
leftJScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
rightJScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
|
|
add(leftJScrollPane); |
|
add(rightJScrollPane); |
|
} |
|
|
|
public void setLeftText(String text) { |
|
this.leftTextArea.setText(text); |
|
} |
|
|
|
public void setRightText(String text) { |
|
this.rightTextArea.setText(text); |
|
} |
|
|
|
public String getLeftText() { |
|
return leftTextArea.getText(); |
|
} |
|
|
|
public String getRightText() { |
|
return rightTextArea.getText(); |
|
} |
|
}
|
|
|