Click here to Skip to main content
15,881,687 members
Articles / Mobile Apps / Android

Texture Atlas Maker

Rate me:
Please Sign up or sign in to vote.
4.94/5 (16 votes)
1 Apr 2012BSD6 min read 142K   7K   55  
A utility to create texture atlases for 2D OpenGL games
import java.awt.Frame;
import java.awt.event.*;
import java.io.IOException;
import javax.swing.*;

import java.awt.*;


public class AboutDialog extends JDialog implements ActionListener
{
	private static final long serialVersionUID = 8668228916639817663L;
	private JEditorPane textCopyRight;
    private JPanel panelMain;
    private JButton btnClose;
	JPanel panelCopyRight;
    public AboutDialog(Frame owner)
	{
		super(owner, "About");
        addWidgets();
		setContentPane(panelMain);
        pack();
        setVisible(false);
	}

    private void addWidgets()
    {
    	textCopyRight = new JEditorPane();
    	textCopyRight.setEditable(false);
    	java.net.URL url = AtlasFrame.class.getResource(
        	"copyright.html");
    	if (url != null) 
    	{
    	    try 
    	    {
    	    	textCopyRight.setPage(url);
    	    } catch (IOException e) 
    	    {
    	        System.err.println("Attempted to read a bad URL: " + url);
    	    }
    	} 
    	else 
    	{
    	    System.err.println("Couldn't find file: copyright.html");
    	}
    	JScrollPane editorScrollPane = new JScrollPane(textCopyRight);
    	editorScrollPane.setVerticalScrollBarPolicy(
    	                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    	editorScrollPane.setPreferredSize(new Dimension(400, 245));
    	editorScrollPane.setMinimumSize(new Dimension(10, 10));
    	panelCopyRight = new JPanel();
    	panelCopyRight.setBorder(BorderFactory.createEmptyBorder());
    	panelCopyRight.add(editorScrollPane);
    	
    	btnClose = new JButton("Close");
    	btnClose.addActionListener(this);
    	btnClose.setAlignmentX(CENTER_ALIGNMENT);

        panelMain = new JPanel();
        panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.PAGE_AXIS));
        panelMain.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
        panelMain.add(panelCopyRight);
        panelMain.add(btnClose);
    }
    
    public void actionPerformed(ActionEvent event)
	{
        if (event.getSource() == btnClose)
        {
        	setVisible(false);
        }		
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Software Developer Astronautz
Spain Spain
After working in the software industry for many years, I've started my own games company that specialises in strategy games for mobile platforms.

Comments and Discussions