本文整理匯總了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);
}