本文整理汇总了Java中javax.swing.text.DefaultCaret.setUpdatePolicy方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultCaret.setUpdatePolicy方法的具体用法?Java DefaultCaret.setUpdatePolicy怎么用?Java DefaultCaret.setUpdatePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.DefaultCaret
的用法示例。
在下文中一共展示了DefaultCaret.setUpdatePolicy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TelemetryToolWindow
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
private TelemetryToolWindow(Project project) {
ToolWindowManager manager = ToolWindowManager.getInstance(project);
if (window == null) {
textPane = new JTextPane();
textPane.setEditable(false);
JBScrollPane scrollPane = new JBScrollPane(textPane);
DefaultCaret caret = (DefaultCaret) textPane.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
textPane.setContentType("text/html");
initHtmlComposer();
window = manager.registerToolWindow(WINDOW_ID, scrollPane, ToolWindowAnchor.BOTTOM);
window.show(EMPTY_TASK);
}
}
示例2: DebugFrame
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
/**
* Creates a new DebugFrame used for the logger to log its messages onto.
*/
public DebugFrame() {
this.setUndecorated(true);
this.setBackground(new Color(0, 0, 0, 0));
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.setSize(Display.WINDOW_WIDTH / 3, Display.WINDOW_HEIGHT);
this.setLayout(new GridLayout(2, 5));
this.setLocation(Display.WINDOW_POSITION);
this.setResizable(false);
this.textPane = new ColorableTextPane();
this.textPane.setFont(new Font("Arial", Font.BOLD, 15));
this.setPreferredSize(new Dimension(Display.WINDOW_WIDTH / 3, Display.WINDOW_HEIGHT));
DefaultCaret caret = (DefaultCaret) this.textPane.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
final JScrollPane sp = new JScrollPane(this.textPane);
sp.getViewport().setBackground(Color.GRAY);
sp.getViewport().setFocusable(false);
sp.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));
this.add(sp);
this.setVisible(true);
}
示例3: PartidaView
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
private PartidaView(Partida partida, boolean inicioTurno, GameCliente gameCliente) {
PARTIDA = partida;
this.gameCliente = gameCliente;
initComponents();
renderGraphics();
this.inicioTurno = inicioTurno;
DefaultCaret caret = (DefaultCaret) jTextAreaHistorico.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
hero = PARTIDA.getHero();
oponente = PARTIDA.getOponente();
adicionarPaineis();
//configura os atalhos da janela atual
inserirAtalhos();
PARTIDA.setPartidaView(getInstance());
PARTIDA.iniciarThreadExecutarJogadas();
glassPane = (JPanel) getInstance().getGlassPane();
glassPane.setLayout(new GridBagLayout());
Arrays.asList(hero, oponente).forEach(Heroi::refreshDanoMagico);
}
示例4: considerSettingFoundPointersTextArea
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
private void considerSettingFoundPointersTextArea()
{
List<MemoryPointer> memoryPointers = memoryPointerSearcher.getMemoryPointers();
if (memoryPointers != null)
{
// Apply sorting
MemoryPointerSorting memoryPointerSorting = sortingSelection.getItemAt(sortingSelection.getSelectedIndex());
Comparator<MemoryPointer> comparator = memoryPointerSorting.getComparator();
memoryPointers.sort(comparator);
// Convert to String
int index = offsetPrintingSettingSelection.getSelectedIndex();
OffsetPrintingSetting offsetPrintingSetting = offsetPrintingSettingSelection.getItemAt(index);
String foundPointersText = MemoryPointer.toString(memoryPointers, offsetPrintingSetting);
// Disable the cursor position from changing when the text area is updated
DefaultCaret caret = (DefaultCaret) foundPointersOutputArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
foundPointersOutputArea.setText(foundPointersText);
}
}
示例5: ErrorWindow
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
public ErrorWindow() {
txtStdErr = new JTextArea();
txtStdErr.setMargin(SizeHelper.getTextMargin());
txtStdErr.setLineWrap(true);
txtStdErr.setEditable(false);
txtStdErr.setWrapStyleWord(true);
txtStdErr.setForeground(Color.RED);
txtStdErr.addMouseListener(new LogAreaMouseListener());
DefaultCaret caret = (DefaultCaret) txtStdErr.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
JScrollPane scrollStdErr = new JScrollPane();
scrollStdErr.setViewportView(txtStdErr);
setLayout(new BorderLayout());
add(scrollStdErr, BorderLayout.CENTER);
addComponentListener(this);
}
示例6: OutputWindow
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
public OutputWindow() {
txtStdOut = new JTextArea();
txtStdOut.setMargin(SizeHelper.getTextMargin());
txtStdOut.setLineWrap(true);
txtStdOut.setEditable(false);
txtStdOut.setWrapStyleWord(true);
txtStdOut.addMouseListener(new LogAreaMouseListener());
DefaultCaret caret = (DefaultCaret) txtStdOut.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
JScrollPane scrollStdOut = new JScrollPane();
scrollStdOut.setViewportView(txtStdOut);
setLayout(new BorderLayout());
add(scrollStdOut, BorderLayout.CENTER);
}
示例7: OrganizationCard
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
public OrganizationCard(Organization organization) {
this.initComponents();
this.organization = organization;
DefaultCaret caret = (DefaultCaret) this.organizationInformation.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
this.organizationName.setText(organization.getName());
String information = organization.getInformation();
if (information.length() > 75) {
information = information.substring(0, 74) + "...";
}
this.organizationInformation.setText(information);
this.organizationSlug.setText("/" + organization.getSlug());
ImageIcon image = new ImageIcon("placeholderLogo.png");
if (!organization.getLogoPath().contains("missing")) {
image = new ImageIcon(logoUrl(organization.getLogoPath()));
}
image.setImage(image.getImage().getScaledInstance(49, 49, java.awt.Image.SCALE_SMOOTH));
this.logo.setIcon(image);
}
示例8: BlockingFrame
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
public BlockingFrame(OrgsecModel model) {
this.model = model;
JFrame frame = new JFrame("orgsec");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jtp = new JTabbedPane();
JTextArea area = new JTextArea();
out = new TextAreaOutputStream(area);
JScrollPane areapane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
DefaultCaret caret = (DefaultCaret) area.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
areapane.setViewportView(area);
jtp.add("blocking", areapane);
frame.setContentPane(jtp);
frame.setSize(400, 400);
frame.setVisible(true);
}
示例9: init
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
/**
*
*/
@Override
public void init() {
display.setLayout(new BorderLayout());
display.setPreferredSize(new Dimension(800, 600));
// --------- text menu begin ------------------------
JPanel menuPanel = createMenuPanel();
display.add(menuPanel, BorderLayout.PAGE_START);
DefaultCaret caret = (DefaultCaret) pythonConsole.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
splitPane = createMainPane();
display.add(splitPane, BorderLayout.CENTER);
display.add(statusInfo, BorderLayout.PAGE_END);
}
示例10: FrmTextEditor
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
/**
* Creates new form FrmTextEditor
*/
public FrmTextEditor() {
initComponents();
DefaultCaret caret = (DefaultCaret) this.jTextArea_Output.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
BufferedImage image = null;
try {
image = ImageIO.read(this.getClass().getResource("/org/meteoinfo/desktop/resources/snake.png"));
this.setIconImage(image);
} catch (Exception e) {
}
this.setScriptLanguage(_scriptLanguage);
addNewTextEditor("New file");
this._splitPanelSize = this.jSplitPane1.getBounds().getSize();
this.setSize(600, 600);
//this.jSplitPane1.setDividerLocation(0.6);
this.jSplitPane1.setDividerLocation(5);
//this.jScrollPane1.invalidate();
}
示例11: DialogHilfe
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
public DialogHilfe(JFrame parent, boolean modal, String text) {
super(parent, modal);
initComponents();
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
DefaultCaret caret = (DefaultCaret) jTextArea1.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
jTextArea1.setText(text);
new EscBeenden(this) {
@Override
public void beenden_() {
dispose();
}
};
jButtonOk.addActionListener(e -> dispose());
getRootPane().setDefaultButton(jButtonOk);
}
示例12: ServerGUI
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
/**
* Constructor which builds up the whole GUI with sizes etc.
*
* @param listener The ActionListener for the GUI
*/
public ServerGUI(ActionListener listener) {
setPreferredSize(new Dimension(800, 850));
setName("ServerGUI");
setLayout(null);
btnExit.setBounds(0, 750, 800, 62);
add(sp);
sp.setBounds(0, 0, 785, 750);
add(btnExit);
taLog.setFont(new Font("Arail", Font.BOLD, 12));
DefaultCaret caret = (DefaultCaret) taLog.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
taLog.setEditable(false);
btnExit.addActionListener(listener);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(null);
setVisible(true);
}
示例13: ConsolePanel
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
public ConsolePanel() {
super(new GridBagLayout());
checkBox = new JCheckBox("Redirect Console", false);
checkBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
redirectSystemStreams(checkBox.isSelected());
}
});
text = new JTextArea("Waiting for State ...");
// text.setEditable(false);
text.setFont(new Font("Courier", Font.PLAIN, 10));
DefaultCaret caret = (DefaultCaret) text.getCaret(); // auto scroll
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
add(new JScrollPane(text), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
add(checkBox, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
示例14: createChatPanel
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
private JPanel createChatPanel(int x, int y, int width, int height)
{
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
panel.setBounds(x, y, width, height);
panel.setBackground(Color.BLACK);
textarea = new JTextArea(10, 20);
textarea.setMargin(new Insets(10, 10, 0, 0));
textarea.setEditable(false);
textarea.setBackground(Color.BLACK);
textarea.setForeground(Color.WHITE);
textarea.setFont(new Font("Courier", Font.BOLD, 14));
JScrollPane scroll = new JScrollPane(textarea);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
DefaultCaret caret = (DefaultCaret)textarea.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
panel.add(scroll);
return panel;
}
示例15: ConsoleTab
import javax.swing.text.DefaultCaret; //导入方法依赖的package包/类
public ConsoleTab(MainWindow main) {
this.main = main;
// area
area = new JTextArea();
Font font = Resources.FONT_CONSOLE;
area.setFont(font);
area.setEditable(false);
DefaultCaret caret = (DefaultCaret) area.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
areaPane = new JScrollPane(area);
// system output
PrintStream windowStream = new PrintStream(new JTextAreaOutputStream(area));
Util.setOutAndErr(windowStream);
// config listener
Config.addConfigListener(this);
Config.notifyConfigListener(this);
}