本文整理汇总了Java中javax.swing.JPanel.repaint方法的典型用法代码示例。如果您正苦于以下问题:Java JPanel.repaint方法的具体用法?Java JPanel.repaint怎么用?Java JPanel.repaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JPanel
的用法示例。
在下文中一共展示了JPanel.repaint方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sdkValid
import javax.swing.JPanel; //导入方法依赖的package包/类
@Override
public void sdkValid() {
fireIconChange();
fireOpenedIconChange();
setChildren(Children.create(new AndroidPlatformChildrenFactory(platform, holder), false));
JPanel tmp = lastBrokenPanel.get();
if (tmp != null) {
tmp.removeAll();
tmp.invalidate();
tmp.repaint();
tmp.setLayout(new java.awt.CardLayout());
tmp.add(new AndroidSdkCustomizer(platform, holder));
tmp.revalidate();
tmp.repaint();
tmp.requestFocus();
}
}
示例2: updateCustomizer
import javax.swing.JPanel; //导入方法依赖的package包/类
public void updateCustomizer() {
if (valid != platform.isValid()) {
valid = platform.isValid();
setChildren(Children.create(new AndroidPlatformChildrenFactory(platform, holder), false));
JPanel tmp = lastBrokenPanel.get();
if (tmp != null) {
tmp.removeAll();
tmp.invalidate();
tmp.repaint();
tmp.setLayout(new java.awt.CardLayout());
if (platform.isValid()) {
tmp.add(new AndroidSdkCustomizer(platform, holder));
} else {
tmp.add(new BrokenPlatformCustomizer(platform, holder, this));
}
tmp.revalidate();
tmp.repaint();
tmp.requestFocus();
}
}
}
示例3: contentChange
import javax.swing.JPanel; //导入方法依赖的package包/类
private void contentChange(DocumentEvent e) {
changed = true;
Document doc = e.getDocument();
CodeCategory category = getCategoryForDocument(doc);
int eBlockIndex = getEditBlockIndex(category, e.getOffset());
if (eBlockIndex < 0) {
return;
}
List<EditableLine> lines = getEditInfos(category)[eBlockIndex].lines;
int[] blockBounds = getEditBlockBounds(category, eBlockIndex);
boolean repaint = false;
Integer lastLineCount = lastDocLineCounts.get(doc);
int lineCount = getLineCount(doc);
if (lastLineCount == null || lastLineCount.intValue() != lineCount) {
lastDocLineCounts.put(doc, Integer.valueOf(lineCount));
updateLines(doc, blockBounds[0], blockBounds[1], lines,
codeData.getEditableBlock(category, eBlockIndex));
repaint = true;
// make sure our listener is invoked after position listeners update
doc.removeDocumentListener(this);
doc.addDocumentListener(this);
}
repaint |= updateGutterComponents(lines, doc, blockBounds[0], blockBounds[1]);
if (repaint) {
JPanel gutter = getGutter(doc);
gutter.revalidate();
gutter.repaint();
}
// ((BaseDocument)doc).resetUndoMerge();
}
示例4: rebuildOnScreenMenu
import javax.swing.JPanel; //导入方法依赖的package包/类
private void rebuildOnScreenMenu(RADVisualContainer menuRAD) {
if(menuRAD == null) return;
if(hackedPopupFactory == null) return;
JMenu menu = (JMenu) formDesigner.getComponent(menuRAD);
if(hackedPopupFactory.containerMap.containsKey(menu)) {
JPanel popupContainer = hackedPopupFactory.containerMap.get(menu);
if(popupContainer == null) return;
for(Component c : popupContainer.getComponents()) {
if(c instanceof JMenu) {
unconfigureMenu((JMenu)c);
} else {
unconfigureMenuItem((JComponent)c);
}
}
popupContainer.removeAll();
// rebuild it
for(RADVisualComponent child : menuRAD.getSubComponents()) {
if(child != null) {
JComponent jchild = (JComponent) formDesigner.getComponent(child);
if(!isConfigured(jchild)) {
if(jchild instanceof JMenu) {
configureMenu(menu, (JMenu)jchild);
} else {
configureMenuItem(menu,jchild);
}
}
popupContainer.add(jchild);
}
}
// repack it
popupContainer.setSize(popupContainer.getLayout().preferredLayoutSize(popupContainer));
validate();
popupContainer.repaint();
}
}
示例5: getTableCellEditorComponent
import javax.swing.JPanel; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, final int column) {
final JComponent c = (JComponent) super.getTableCellEditorComponent(table, value, isSelected, row, column);
this.tableModel = table.getModel();
this.columnName = table.getColumnName(column);
this.modelRow = table.convertRowIndexToModel(row);
this.modelColumn = table.convertColumnIndexToModel(column);
this.tc = c instanceof JTextComponent ? (JTextComponent) c : null;
JPanel panel = new JPanel(new BorderLayout()) {
@Override
public void addNotify() {
super.addNotify();
c.requestFocus();
}
};
panel.add(c);
if (suppressEditorBorder) {
c.setBorder(BorderFactory.createEmptyBorder());
}
panel.add(customEditorButton, BorderLayout.EAST);
panel.revalidate();
panel.repaint();
return panel;
}
示例6: replacePage
import javax.swing.JPanel; //导入方法依赖的package包/类
public void replacePage(JPanel parent, JPanel child)
{
parent.removeAll();
parent.add(child);
parent.revalidate();
parent.repaint();
}
示例7: addDevPasswordField
import javax.swing.JPanel; //导入方法依赖的package包/类
public void addDevPasswordField() {
inputDevPasswordPanel = new JPanel();
inputDevPasswordLabel = new JLabel("Password:");
inputDevPasswordText = new JTextField(10);
inputDevPasswordPanel.add(inputDevPasswordLabel);
inputDevPasswordPanel.add(inputDevPasswordText);
serverPanel.add(inputDevPasswordPanel, BorderLayout.SOUTH );
inputDevPasswordPanel.repaint();
serverPanel.repaint();
option.pack();
option.show();
}
示例8: saveFinal
import javax.swing.JPanel; //导入方法依赖的package包/类
public void saveFinal(JPanel panel, String jogoNro) {
try {
panel.validate();
panel.repaint();
panel.validate();
panel.repaint();
Container c = panel;
BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
c.paint(im.getGraphics());
ImageIO.write(im, "PNG", new File(PATH + File.separator + "jogo" + jogoNro + ".png"));
} catch (IOException ex) {
Logger.getLogger(OthelloTournament.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例9: updateCharts
import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* Updates the charts.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
for (int i = 0; i < listOfChartPanels.size(); i++) {
JPanel panel = listOfChartPanels.get(i);
panel.removeAll();
final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {
private static final long serialVersionUID = -6953213567063104487L;
@Override
public Dimension getPreferredSize() {
return DIMENSION_CHART_PANEL_ENLARGED;
}
};
chartPanel.setPopupMenu(null);
chartPanel.setBackground(COLOR_TRANSPARENT);
chartPanel.setOpaque(false);
chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
panel.add(chartPanel, BorderLayout.CENTER);
JPanel openChartPanel = new JPanel(new GridBagLayout());
openChartPanel.setOpaque(false);
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.NONE;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
JButton openChartButton = new JButton(OPEN_CHART_ACTION);
openChartButton.setOpaque(false);
openChartButton.setContentAreaFilled(false);
openChartButton.setBorderPainted(false);
openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
openChartButton.setIcon(null);
Font font = openChartButton.getFont();
Map attributes = font.getAttributes();
attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));
openChartPanel.add(openChartButton, gbc);
panel.add(openChartPanel, BorderLayout.SOUTH);
panel.revalidate();
panel.repaint();
}
}
示例10: UpperToolbarActionListener
import javax.swing.JPanel; //导入方法依赖的package包/类
public ActionListener UpperToolbarActionListener(final JPanel mainPanel) {
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == roomsBtn) {
theRooms = new Main_AllRooms();
infoColorTable = new ColorInfoTable();
// Set the usage of room into info table
infoColorTable.setCleanLabelCount(theRooms.cleanCounter);
infoColorTable.setDirtyLabelCount(theRooms.dirtyCounter);
infoColorTable.setDndLabelCount(theRooms.dndCounter);
mainPanel.removeAll();
mainPanel.add(theRooms.getWindow(), BorderLayout.WEST);
mainPanel.add(infoColorTable, BorderLayout.EAST);
mainPanel.revalidate();
mainPanel.repaint();
} else if (e.getSource() == guestsBtn) {
customersFrame = new Main_CustomersFrame();
mainPanel.removeAll();
mainPanel.add(customersFrame, BorderLayout.CENTER);
mainPanel.revalidate();
mainPanel.repaint();
} else if (e.getSource() == rezervationBtn) {
rezervFrame = new Main_Reservations();
mainPanel.removeAll();
rezervFrame.populateMainTable();
mainPanel.add(rezervFrame, BorderLayout.CENTER);
mainPanel.revalidate();
mainPanel.repaint();
} else if (e.getSource() == blockadeBtn) {
blockadeFrame = new Main_Blockade();
mainPanel.removeAll();
mainPanel.add(blockadeFrame, BorderLayout.CENTER);
mainPanel.revalidate();
mainPanel.repaint();
} else if (e.getSource() == roomCleaningBtn) {
cleaningFrame = new Main_RoomCleaning();
mainPanel.removeAll();
mainPanel.add(cleaningFrame, BorderLayout.CENTER);
mainPanel.revalidate();
mainPanel.repaint();
} else if (e.getSource() == cashBtn) {
cashdesk = new Main_CashDesk();
mainPanel.removeAll();
mainPanel.add(cashdesk, BorderLayout.CENTER);
mainPanel.revalidate();
mainPanel.repaint();
} else if (e.getSource() == auditBtn) {
audit = new Main_Audit();
audit.initializeAuditPane();
mainPanel.removeAll();
mainPanel.add(audit, BorderLayout.CENTER);
mainPanel.revalidate();
mainPanel.repaint();
} else if (e.getSource() == refreshBtn) {
mainPanel.removeAll();
mainPanel.revalidate();
mainPanel.repaint();
}
}
};
return actionListener;
}
示例11: attemptToShowFullUi
import javax.swing.JPanel; //导入方法依赖的package包/类
private void attemptToShowFullUi()
{
if( tree != null )
{
return;
}
GlassSwingWorker<?> worker = new GlassSwingWorker<Boolean>()
{
private Map<String, Pair<String, String>> predefinedTermDataKeys;
@Override
public Boolean construct() throws Exception
{
boolean valid = taxonomy != null
&& clientService.getService(RemoteTaxonomyService.class).identifyByUuid(taxonomy.getUuid()) != 0;
if( valid )
{
predefinedTermDataKeys = new HashMap<String, Pair<String, String>>();
for( Extension ext : pluginService.getConnectedExtensions("com.tle.admin.taxonomy.tool",
"predefinedTermDataKey") )
{
final String key = ext.getParameter("key").valueAsString();
final String name = CurrentLocale.get(ext.getParameter("name").valueAsString());
final String desc = CurrentLocale.get(ext.getParameter("description").valueAsString());
predefinedTermDataKeys.put(key, new Pair<String, String>(name, desc));
}
}
return valid;
}
@Override
public void finished()
{
if( !get() )
{
return;
}
final JPanel p = InternalDataSourceTab.this;
// Remove this listener and clear the panel
p.removeComponentListener(ensureTaxonomySavedListener);
p.removeAll();
final RemoteTermService termService = clientService.getService(RemoteTermService.class);
tree = new AbstractTreeEditor<TermTreeNode>()
{
@Override
protected AbstractTreeEditorTree<TermTreeNode> createTree()
{
return new TermTree(taxonomy, true, termService);
}
@Override
protected AbstractTreeNodeEditor createEditor(TermTreeNode node)
{
return new TermEditor(termService, predefinedTermDataKeys, taxonomy, node);
}
};
p.setLayout(new MigLayout("wrap 1, fill"));
p.add(new JLabel("<html>" + s("immediatechanges")));
p.add(tree, "push, grow");
p.revalidate();
p.repaint();
}
};
worker.setComponent(InternalDataSourceTab.this);
worker.start();
}
示例12: TestFrame
import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* Create the frame.
*/
public TestFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
contentPane.add(new JComponent() {
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
for(int i=0;i<200;i++){
g2d.fill(UniversalTool.getPointOval(0, 10*i, 5));
g2d.fill(UniversalTool.getPointOval(10*i, 0, 5));
}
Ellipse e = UniversalTool.getTestEllipse(10);
Ellipse2D.Double ed = e.getErectedEllipse2D();
//save old transform
AffineTransform old = g2d.getTransform();
for (Point_ p : e.getKeyPoints()){
g2d.fill(UniversalTool.getPointOval(p, 5));
}
// for(int i=0;i<12;i++){
// g2d.setTransform(old);
// trf.rotate(Math.toRadians(30*i),e.x,e.y);
// g2d.setTransform(trf);
// g2d.draw(ed);
// }
g2d.rotate(e.angle,e.x,e.y);
//draw elps
g2d.setColor(Color.GREEN);
g2d.draw(ed);
//draw pts
g2d.setColor(Color.RED);
//revert transform
g2d.setTransform(old);
// g2d.setStroke(new BasicStroke(10));
// g2d.draw(new Line2D.Float(30, 20, 80, 90));
}
});
contentPane.repaint();
}
示例13: clearPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
public void clearPanel(JPanel panel) {
panel.removeAll();
panel.repaint();
}