本文整理汇总了Java中java.awt.Canvas.setMaximumSize方法的典型用法代码示例。如果您正苦于以下问题:Java Canvas.setMaximumSize方法的具体用法?Java Canvas.setMaximumSize怎么用?Java Canvas.setMaximumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Canvas
的用法示例。
在下文中一共展示了Canvas.setMaximumSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AView
import java.awt.Canvas; //导入方法依赖的package包/类
/**
* Initiates a new View instance.
*
* @param title
* The title displayed on the frame.
* @param width
* The width of the frame.
* @param height
* The height of the frame.
* @param manager
* The RenderManager of this View, managing render layers.
*/
public AView(String mTitle, int mWidth, int mHeight, RenderManager mManager) {
super(0, 0, mWidth, mHeight);
manager = mManager;
title = mTitle;
height = mHeight;
width = mWidth;
frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setSize(width, height);
frame.setLocationRelativeTo(null);
frame.setVisible(false);
canvas = new Canvas();
canvas.setPreferredSize(new Dimension(width, height));
canvas.setMaximumSize(new Dimension(width, height));
canvas.setMinimumSize(new Dimension(width, height));
canvas.setFocusable(false);
canvas.setBounds(0, 0, width, height);
frame.add(canvas);
}
示例2: createDisplay
import java.awt.Canvas; //导入方法依赖的package包/类
private void createDisplay(){
frame = new JFrame(title);
frame.setSize(width, height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
canvas = new Canvas();
canvas.setPreferredSize(new Dimension(width, height));
canvas.setMaximumSize(new Dimension(width, height));
canvas.setMinimumSize(new Dimension(width, height));
frame.add(canvas);
frame.pack();
}
示例3: Window
import java.awt.Canvas; //导入方法依赖的package包/类
public Window(KTech gc) {
image = new BufferedImage(gc.getWidth(), gc.getHeight(), BufferedImage.TYPE_INT_RGB); //Passes through the width and height
canvas = new Canvas();
Dimension s = new Dimension((int)(gc.getWidth() * gc.getScale()), (int)(gc.getHeight() * gc.getScale()));
canvas.setPreferredSize(s);
canvas.setMaximumSize(s);
canvas.setPreferredSize(s);
//Setting up the JFrame
frame = new JFrame(gc.getTitle());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(canvas, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setVisible(true);
canvas.createBufferStrategy(1);
bs = canvas.getBufferStrategy();
g = bs.getDrawGraphics();
}
示例4: createDisplay
import java.awt.Canvas; //导入方法依赖的package包/类
private void createDisplay()
{
//Creates JFrame with constructor data
frame = new JFrame(title);
frame.setSize(width, height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
//Creates a Canvas to draw the game on
canvas = new Canvas();
canvas.setBackground(Color.BLACK);
canvas.setPreferredSize(new Dimension(width, height));
canvas.setMaximumSize(new Dimension(width, height));
canvas.setMinimumSize(new Dimension(width, height));
canvas.setFocusable(false);
//Adds canvas to JFram
frame.add(canvas);
frame.pack();
}
示例5: QuickFrame
import java.awt.Canvas; //导入方法依赖的package包/类
/**
* Builds a new frame.
*
* @throws IllegalArgumentException
* Problem while accessing the game data.
* @throws SecurityException
* Problem while accessing the game data.
* @throws ParserConfigurationException
* Problem while accessing the game data.
* @throws SAXException
* Problem while accessing the game data.
* @throws IOException
* Problem while accessing the game data.
* @throws IllegalAccessException
* Problem while accessing the game data.
* @throws NoSuchFieldException
* Problem while accessing the game data.
* @throws ClassNotFoundException
* Problem while accessing the game data.
*/
public QuickFrame() throws IllegalArgumentException, SecurityException, ParserConfigurationException, SAXException, IOException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException
{ // init
super("TBB v."+GameData.VERSION+" (Quicklaunch)");
// panel size
Dimension contentDimension = Configuration.getVideoConfiguration().getPanelDimension();
// create canvas
canvas = new Canvas();
canvas.setIgnoreRepaint(true);
// canvas.setSize(dim);
canvas.setMinimumSize(contentDimension);
canvas.setPreferredSize(contentDimension);
canvas.setMaximumSize(contentDimension);
add(canvas);
// create progress bar
remove(canvas);
loadProgressBar = new JProgressBar();
// loadProgressBar.setSize(dim);
loadProgressBar.setMinimumSize(contentDimension);
loadProgressBar.setPreferredSize(contentDimension);
loadProgressBar.setMaximumSize(contentDimension);
loadProgressBar.setStringPainted(true);
loadProgressBar.setFont(GuiConfiguration.getMiscConfiguration().getFont().deriveFont(contentDimension.height/2f));
getContentPane().add(loadProgressBar);
// tournament
QuickStartConfiguration quickStartConfiguration = Configuration.getGameConfiguration().getQuickStartConfiguration();
tournament = quickStartConfiguration.loadQuickstart();
List<Profile> selectedProfiles = new ArrayList<Profile>();
ProfilesSelection profilesSelection = quickStartConfiguration.getProfilesSelection();
selectedProfiles = ProfileLoader.loadProfiles(profilesSelection);
tournament.setProfiles(selectedProfiles);
tournament.init();
tournament.progress();
// match
Match match = tournament.getCurrentMatch();
match.progress();
//round
round = match.getCurrentRound();
round.setPanel(this);
int limit = round.getProfiles().size()+3;
loadProgressBar.setMinimum(0);
loadProgressBar.setMaximum(limit);
}