本文整理汇总了Java中javax.swing.text.JTextComponent.revalidate方法的典型用法代码示例。如果您正苦于以下问题:Java JTextComponent.revalidate方法的具体用法?Java JTextComponent.revalidate怎么用?Java JTextComponent.revalidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.JTextComponent
的用法示例。
在下文中一共展示了JTextComponent.revalidate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertyChange
import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
public void propertyChange(java.beans.PropertyChangeEvent evt) {
JTextComponent component = (JTextComponent)getContainer();
if (component==null || evt==null ||
(!EditorUI.LINE_HEIGHT_CHANGED_PROP.equals(evt.getPropertyName()) &&
!EditorUI.TAB_SIZE_CHANGED_PROP.equals(evt.getPropertyName())
)
) {
return;
}
AbstractDocument doc = (AbstractDocument)getDocument();
if (doc!=null) {
doc.readLock();
try{
LockView lockView = LockView.get(this);
lockView.lock();
try {
rebuild(0, getViewCount());
} finally {
lockView.unlock();
}
} finally {
doc.readUnlock();
}
component.revalidate();
}
}
示例2: startEditing
import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
public void startEditing(Object cell, EventObject evt)
{
if (editingCell != null)
{
stopEditing(true);
}
mxCellState state = graphComponent.getGraph().getView().getState(cell);
if (state != null)
{
editingCell = cell;
trigger = evt;
double scale = Math.max(minimumEditorScale, graphComponent
.getGraph().getView().getScale());
scrollPane.setBounds(getEditorBounds(state, scale));
scrollPane.setVisible(true);
String value = getInitialValue(state, evt);
JTextComponent currentEditor = null;
// Configures the style of the in-place editor
if (graphComponent.getGraph().isHtmlLabel(cell))
{
if (isExtractHtmlBody())
{
value = mxUtils.getBodyMarkup(value,
isReplaceHtmlLinefeeds());
}
editorPane.setDocument(mxUtils.createHtmlDocumentObject(
state.getStyle(), scale));
editorPane.setText(value);
// Workaround for wordwrapping in editor pane
// FIXME: Cursor not visible at end of line
JPanel wrapper = new JPanel(new BorderLayout());
wrapper.setOpaque(false);
wrapper.add(editorPane, BorderLayout.CENTER);
scrollPane.setViewportView(wrapper);
currentEditor = editorPane;
}
else
{
textArea.setFont(mxUtils.getFont(state.getStyle(), scale));
Color fontColor = mxUtils.getColor(state.getStyle(),
mxConstants.STYLE_FONTCOLOR, Color.black);
textArea.setForeground(fontColor);
textArea.setText(value);
scrollPane.setViewportView(textArea);
currentEditor = textArea;
}
graphComponent.getGraphControl().add(scrollPane, 0);
if (isHideLabel(state))
{
graphComponent.redraw(state);
}
currentEditor.revalidate();
currentEditor.requestFocusInWindow();
currentEditor.selectAll();
configureActionMaps();
}
}
示例3: startEditing
import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
public void startEditing(Object cell, EventObject evt) {
if (editingCell != null) {
stopEditing(true);
}
mxCellState state = graphComponent.getGraph().getView().getState(cell);
if (state != null) {
editingCell = cell;
trigger = evt;
double scale = Math.max(minimumEditorScale, graphComponent.getGraph().getView().getScale());
scrollPane.setBounds(getEditorBounds(state, scale));
scrollPane.setVisible(true);
String value = getInitialValue(state, evt);
JTextComponent currentEditor = null;
// Configures the style of the in-place editor
if (graphComponent.getGraph().isHtmlLabel(cell)) {
if (isExtractHtmlBody()) {
value = mxUtils.getBodyMarkup(value, isReplaceHtmlLinefeeds());
}
editorPane.setDocument(mxUtils.createHtmlDocumentObject(state.getStyle(), scale));
editorPane.setText(value);
// Workaround for wordwrapping in editor pane
// FIXME: Cursor not visible at end of line
JPanel wrapper = new JPanel(new BorderLayout());
wrapper.setOpaque(false);
wrapper.add(editorPane, BorderLayout.CENTER);
scrollPane.setViewportView(wrapper);
currentEditor = editorPane;
} else {
textArea.setFont(mxUtils.getFont(state.getStyle(), scale));
Color fontColor =
mxUtils.getColor(state.getStyle(), mxConstants.STYLE_FONTCOLOR, Color.black);
textArea.setForeground(fontColor);
textArea.setText(value);
scrollPane.setViewportView(textArea);
currentEditor = textArea;
}
graphComponent.getGraphControl().add(scrollPane, 0);
if (isHideLabel(state)) {
graphComponent.redraw(state);
}
currentEditor.revalidate();
currentEditor.requestFocusInWindow();
currentEditor.selectAll();
configureActionMaps();
}
}