当前位置: 首页>>代码示例>>Java>>正文


Java JFrame.repaint方法代码示例

本文整理汇总了Java中javax.swing.JFrame.repaint方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.repaint方法的具体用法?Java JFrame.repaint怎么用?Java JFrame.repaint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JFrame的用法示例。


在下文中一共展示了JFrame.repaint方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCheckBoxToPanel

import javax.swing.JFrame; //导入方法依赖的package包/类
public void addCheckBoxToPanel(Food food) {
    JFrame frame = this;
    jPanel2.setLayout(new GridLayout(0, 4));
    final JCheckBox box = new JCheckBox(food.getFood());
    box.setActionCommand(String.valueOf(food.getId()));
    box.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (box.isSelected()) {
                jTextArea1.append(box.getText() + "\n");
                selectedFoodIds.add(Integer.parseInt(box.getActionCommand()));
            }
        }
    });
    jPanel2.add(box);
    frame.revalidate();
    frame.repaint();
}
 
开发者ID:seyidkanan,项目名称:my-diploma-work,代码行数:19,代码来源:IngredientsFrame.java

示例2: setUp

import javax.swing.JFrame; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    if (setup) return;
    
    try {
        focusWorks = ExtTestCase.canSafelyRunFocusTests();
        if (!focusWorks) {
            return;
        }
        
        tp = new TProperty("Dont set me!", true);
        
        tn = new TNode();
        //            PropUtils.forceRadioButtons=true;
        final PropertySheet ps = new PropertySheet();
        
        //ensure no stored value in preferences:
        ps.setCurrentNode(tn);
        sleep();
        ps.setSortingMode(PropertySheet.UNSORTED);
        
        jf = new JFrame();
        jf.getContentPane().add(ps);
        jf.setLocation(20,20);
        jf.setSize(300, 400);
        new WaitWindow(jf);
        tb = ps.table;
        
        jf.repaint();
        
        
    } catch (Exception e) {
        e.printStackTrace();
        fail("FAILED - Exception thrown "+e.getClass().toString());
    } finally {
        setup = true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:FocusAfterBadEditTest.java

示例3: resetLoginUI

import javax.swing.JFrame; //导入方法依赖的package包/类
private void resetLoginUI(int x, int y, JFrame f, JPanel loginPanel, JLabel logoLabel,
		JTextField usernameTextField, JTextField passwordTextField,
		JButton signInButton, JButton logInButton, JButton settingsButton,
		JLabel bgLabel) {

	int i = y - 520;

	f.remove(loginPanel);
	f.setSize(x, y);
	f.revalidate();

	loginPanel.setBounds(0, 0, x, y);
	logoLabel.setBounds(x / 2 - 200, i / 2, 400, 190);
	usernameTextField.setBounds(x / 2 - 200, i / 2 + 200, 400, 100);
	passwordTextField.setBounds(x / 2 - 200, i / 2 + 310, 400, 100);
	signInButton.setBounds(x / 2 - 200, i / 2 + 420, 195, 100);
	logInButton.setBounds(x / 2 + 5, i / 2 + 420, 195, 100);
	settingsButton.setBounds(x - 70, 10, 60, 60);
	bgLabel.setBounds(0, 0, x, y);

	f.add(loginPanel);
	f.revalidate();
	f.repaint();

}
 
开发者ID:berkunal,项目名称:SWEngProject,代码行数:26,代码来源:Menu.java

示例4: resetUIMainMenu

import javax.swing.JFrame; //导入方法依赖的package包/类
private void resetUIMainMenu(int x, int y, JFrame f, JPanel mainMenuPanel, JLabel bgLabel,
		JLabel logoLabel, JButton newGameButton, JButton optionsButton,
		JButton instrButton, JButton exitButton) {
	
	int i = y - 520;
	
	f.remove(mainMenuPanel);
	f.setSize(x, y);
	f.revalidate();
	
	mainMenuPanel.setBounds(0, 0, x, y);
	bgLabel.setBounds(0, 0, x, y);
	logoLabel.setBounds(x / 2 - 200, i / 2, 400, 190);
	newGameButton.setBounds(x / 2 - 200, i / 2 + 200, 400, 70);
	optionsButton.setBounds(x / 2 - 200, i / 2 + 280, 400, 70);
	instrButton.setBounds(x / 2 - 200, i / 2 + 360, 400, 70);
	exitButton.setBounds(x / 2 - 200, i / 2 + 440, 400, 70);		
	
	f.add(mainMenuPanel);
	f.revalidate();
	f.repaint();

}
 
开发者ID:berkunal,项目名称:SWEngProject,代码行数:24,代码来源:MainMenu.java

示例5: saveGameRecord

import javax.swing.JFrame; //导入方法依赖的package包/类
public void saveGameRecord(JFrame frame, String competidores, PvpScore pvpScore) {
    try {
        frame.validate();
        frame.repaint();            
        Container c = frame.getContentPane();
        c.validate();
        c.repaint();
        BufferedImage im = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
        c.paint(im.getGraphics());
        pvpScore.setGameRecord(im);
    } catch (Exception ex) {
        Logger.getLogger(OthelloTournament.class
                .getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:data-library,项目名称:jOthelloT,代码行数:16,代码来源:OthelloTournament.java

示例6: setUp

import javax.swing.JFrame; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    if (setup) return;
    PropUtils.forceRadioButtons=false;
    
    try {
        
        tp = new TProperty("oh", true);
        tp1 = new TProperty2("the", true);
        tp2 = new TProperty2("pretty", true);
        tp3 = new TProperty2("pictures",true);
        tp4 = new TProperty3("I can create",true);
        postSetAction = new PostSetAction();
        
        tn = new TNode();
        
        final PropertySheet ps = new PropertySheet();
        
        //ensure no stored value in preferences:
        ps.setCurrentNode(tn);
        sleep();
        ps.setSortingMode(PropertySheet.UNSORTED);
        
        jf = new JFrame();
        jf.getContentPane().add(ps);
        jf.setLocation(20,20);
        jf.setSize(300, 400);
        new WaitWindow(jf);
        tb = ps.table;
        
        ps.setSortingMode(ps.SORTED_BY_NAMES);
        jf.repaint();
        
        
    } catch (Exception e) {
        e.printStackTrace();
        fail("FAILED - Exception thrown "+e.getClass().toString());
    } finally {
        setup = true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:PropertyMarkingTest.java

示例7: ungrayMainWindow

import javax.swing.JFrame; //导入方法依赖的package包/类
private void ungrayMainWindow() {
    if (oldGlassPane != null) {
        JFrame jf = (JFrame) WindowManager.getDefault().getMainWindow();
        jf.setGlassPane(oldGlassPane);
        jf.getGlassPane().setVisible(false);          
        jf.invalidate();
        jf.repaint();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:AbstractWindowRunner.java

示例8: doShowBusyCursor

import javax.swing.JFrame; //导入方法依赖的package包/类
private static void doShowBusyCursor(boolean busy) {
    JFrame mainWindow = (JFrame)WindowManager.getDefault().getMainWindow();
    if(busy){
        RepaintManager.currentManager(mainWindow).paintDirtyRegions();
        mainWindow.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        mainWindow.getGlassPane().setVisible(true);
        mainWindow.repaint();
    } else {
        mainWindow.getGlassPane().setVisible(false);
        mainWindow.getGlassPane().setCursor(null);
        mainWindow.repaint();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:QueryBuilder.java

示例9: switchCurrentEditor

import javax.swing.JFrame; //导入方法依赖的package包/类
private boolean switchCurrentEditor() {
    final TopComponent tc = TopComponent.getRegistry().getActivated();
    if( null == tc || !TopComponentTracker.getDefault().isEditorTopComponent( tc ) )
        return false;

    final WindowManagerImpl wmi = WindowManagerImpl.getInstance();
    final JFrame mainWnd = ( JFrame ) wmi.getMainWindow();
    if( SwingUtilities.isDescendingFrom( tc, mainWnd.getContentPane() ) )
        return true;
    JPanel panel = new JPanel( new BorderLayout() );
    panel.add( tc, BorderLayout.CENTER  );
    try {
        mainWnd.setContentPane( panel );
    } catch( IndexOutOfBoundsException e ) {
        Logger.getLogger(EditorOnlyDisplayer.class.getName()).log(Level.INFO, "Error while switching current editor.", e);
        //#245541 - something is broken in the component hierarchy, let's try restoring to the default mode
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                cancel(false);
            }
        });
    }
    mainWnd.invalidate();
    mainWnd.revalidate();
    mainWnd.repaint();
    SwingUtilities.invokeLater( new Runnable() {
        @Override
        public void run() {
            tc.requestFocusInWindow();
        }
    });
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:EditorOnlyDisplayer.java

示例10: main

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
    final JFrame frame = new DrawBitmaskToSurfaceTest();
    frame.setBounds(10, 350, 200, 200);
    frame.setVisible(true);

    Thread.sleep(2000);

    System.err.println("Change frame bounds...");
    latch = new CountDownLatch(1);
    frame.setBounds(10, 350, 90, 90);
    frame.repaint();

    try {
        if (latch.getCount() > 0) {
            latch.await();
        }
    } catch (InterruptedException e) {
    }

    frame.dispose();

    if (theError != null) {
        throw new RuntimeException("Test failed.", theError);
    }

    System.err.println("Test passed");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:DrawBitmaskToSurfaceTest.java

示例11: plot

import javax.swing.JFrame; //导入方法依赖的package包/类
public static void plot(float[][] w,Scaling scaling)
    {
        ImageDisplay disp=ImageDisplay.createOpenGLCanvas();
        
        float max=Float.NEGATIVE_INFINITY;
        float min=Float.POSITIVE_INFINITY;
        for (int i=0; i<w.length; i++)
            for (int j=0; j<w[i].length; j++)
            {   max=Math.max(max,w[i][j]);
                min=Math.min(min,w[i][j]);
            }
        
        max=Math.max(max,min+Float.MIN_VALUE);
        
        
        max=Math.abs(max);
        min=Math.abs(min);
        float absmax=Math.max(min,max);
        
        if (scaling==Scaling.FitAboutZero)
        {
            
            max=absmax;
            min=-absmax;
        }
        
        
        final DecimalFormat myFormatter = new DecimalFormat("0.###");
        
        disp.setImageSize(w[0].length,w.length);
        
        disp.setSize(300,300);
        
        disp.setTitleLabel("Range: [ "+myFormatter.format(min)+"   "+myFormatter.format(max)+" ] ");
        
//        disp.setPreferredSize(new Dimension(300,300));
        
        for (int i=0; i<w.length; i++)
            for (int j=0; j<w[i].length; j++)
            {   float val=w[i][j];
                if (val>0)
                    disp.setPixmapRGB(j, i, val/absmax, 0, 0);
                else
                    disp.setPixmapRGB(j, i, 0, 0, -val/absmax);
                
            }
//                disp.setPixmapGray(j,i,(w[i][j]-min)/(max-min));    
        
            
        JFrame frm=new JFrame();
        frm.setSize(new Dimension(400,400));
        
        
        frm.getContentPane().add(disp);
        
        frm.setVisible(true);
        
        frm.repaint();
    }
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:60,代码来源:KernelMaker2D.java


注:本文中的javax.swing.JFrame.repaint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。