Check-in [6db53f78f2]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add base for UIForms and UIFormEngines, have figured out how I want to go about this.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip-midlcdui
Files: files | file ages | folders
SHA1: 6db53f78f211d2f565f228681bb0993065ce87b0
User & Date: stephanie.gawroriski 2020-06-30 23:59:20
Context
2020-07-01
23:23
Bunch of base LCDUI work; Try to print the backup trace in a TODO. check-in: edfdef8e10 user: stephanie.gawroriski tags: wip-midlcdui
2020-06-30
23:59
Add base for UIForms and UIFormEngines, have figured out how I want to go about this. check-in: 6db53f78f2 user: stephanie.gawroriski tags: wip-midlcdui
22:38
Add missing package-info for LCDUI. check-in: 0cf5da7bb0 user: stephanie.gawroriski tags: wip-midlcdui
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/MLEDispatcher.java.

15
16
17
18
19
20
21

22
23
24
25
26
27
28
..
68
69
70
71
72
73
74




75
76
77
78
79
80
81
import cc.squirreljme.jvm.mle.MathShelf;
import cc.squirreljme.jvm.mle.ObjectShelf;
import cc.squirreljme.jvm.mle.ReferenceShelf;
import cc.squirreljme.jvm.mle.RuntimeShelf;
import cc.squirreljme.jvm.mle.TerminalShelf;
import cc.squirreljme.jvm.mle.ThreadShelf;
import cc.squirreljme.jvm.mle.TypeShelf;

import cc.squirreljme.vm.springcoat.exceptions.SpringVirtualMachineException;
import java.util.Map;
import java.util.TreeMap;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.MethodNameAndType;

/**
................................................................................
	/** {@link ThreadShelf}. */
	THREAD("cc/squirreljme/jvm/mle/ThreadShelf",
		MLEThread.values()),
	
	/** {@link TypeShelf}. */
	TYPE("cc/squirreljme/jvm/mle/TypeShelf",
		MLEType.values()),




	
	/* End. */
	;
	
	/** The function tree. */
	private static Map<String, Map<String, MLEDispatcherTarget>> _fnTree;
	







>







 







>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import cc.squirreljme.jvm.mle.MathShelf;
import cc.squirreljme.jvm.mle.ObjectShelf;
import cc.squirreljme.jvm.mle.ReferenceShelf;
import cc.squirreljme.jvm.mle.RuntimeShelf;
import cc.squirreljme.jvm.mle.TerminalShelf;
import cc.squirreljme.jvm.mle.ThreadShelf;
import cc.squirreljme.jvm.mle.TypeShelf;
import cc.squirreljme.jvm.mle.UIFormShelf;
import cc.squirreljme.vm.springcoat.exceptions.SpringVirtualMachineException;
import java.util.Map;
import java.util.TreeMap;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.MethodNameAndType;

/**
................................................................................
	/** {@link ThreadShelf}. */
	THREAD("cc/squirreljme/jvm/mle/ThreadShelf",
		MLEThread.values()),
	
	/** {@link TypeShelf}. */
	TYPE("cc/squirreljme/jvm/mle/TypeShelf",
		MLEType.values()),
	
	/** {@link UIFormShelf}. */
	UI_FORM("cc/squirreljme/jvm/mle/UIFormShelf",
		MLEUIForm.values()),
	
	/* End. */
	;
	
	/** The function tree. */
	private static Map<String, Map<String, MLEDispatcherTarget>> _fnTree;
	

Added emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/MLEUIForm.java.



































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.jvm.mle.UIFormShelf;
import cc.squirreljme.jvm.mle.constants.UIMetricType;
import cc.squirreljme.jvm.mle.exceptions.MLECallError;
import cc.squirreljme.runtime.cldc.debug.Debugging;
import java.awt.HeadlessException;
import java.awt.Toolkit;

/**
 * SpringCoat support for {@link UIFormShelf}.
 *
 * @since 2020/06/30
 */
public enum MLEUIForm
	implements MLEFunction
{
	/** {@link UIFormShelf#metric(int)}. */
	METRIC("metric:(I)I")
	{
		/**
		 * {@inheritDoc}
		 * @since 2020/06/30
		 */
		@Override
		public Object handle(SpringThreadWorker __thread, Object... __args)
		{
			int metric = (int)__args[0];
			if (metric < 0 || metric >= UIMetricType.NUM_METRICS)
				throw new MLECallError("Invalid metric.");
			
			switch (metric)
			{
					// Simplest way to check if forms are supported is if
					// the display is headless or not
				case UIMetricType.UIFORMS_SUPPORTED:
					try
					{
						// Just try to read the screen size
						if (null == Toolkit.getDefaultToolkit()
							.getScreenSize())
							return 0;
						
						return 1;
					}
					catch (HeadlessException e)
					{
						return 0;
					}
				
				default:
					throw new RuntimeException("Unknown metric: " + metric);
			}
		}
	}, 
	
	/* End. */
	;
	
	/** The dispatch key. */
	protected final String key;
	
	/**
	 * Initializes the dispatcher info.
	 *
	 * @param __key The key.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/06/30
	 */
	MLEUIForm(String __key)
		throws NullPointerException
	{
		if (__key == null)
			throw new NullPointerException("NARG");
		
		this.key = __key;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2020/06/30
	 */
	@Override
	public String key()
	{
		return this.key;
	}
}

Added modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/UIFormShelf.java.







































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.mle;

import cc.squirreljme.jvm.mle.constants.UIFormSpecialPositionType;
import cc.squirreljme.jvm.mle.constants.UIMetricType;
import cc.squirreljme.jvm.mle.exceptions.MLECallError;

/**
 * This is the shelf which manages all of the form based user interface that
 * LCDUI uses and such.
 * 
 * Every item on the form has an index, while some have special index numbers
 * which indicate that the element should be placed in a unique position. The
 * special positions are identified in {@link UIFormSpecialPositionType}.
 *
 * @since 2020/06/30
 */
public final class UIFormShelf
{
	/**
	 * Not used.
	 * 
	 * @since 2020/06/30
	 */
	private UIFormShelf()
	{
	}
	
	/**
	 * Returns a metric which describes something about the user interface
	 * forms implementation or other details about the system.
	 * 
	 * @param __metric One of {@link UIMetricType}. The metric
	 * {@link UIMetricType#UIFORMS_SUPPORTED} is always a valid metric and
	 * must be supported, even if the implementation lacks forms.
	 * @return The value of the metric.
	 * @throws MLECallError If the metric is out of range or forms are not
	 * supported and the metric is not {@link UIMetricType#UIFORMS_SUPPORTED}.
	 * @since 2020/06/30
	 */
	public static native int metric(int __metric)
		throws MLECallError;
}

Added modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/constants/UIFormSpecialPositionType.java.





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.mle.constants;

/**
 * These indexes in this class are the special form indexes which specify that
 * certain form items be placed in a special position.
 * 
 * All of these values are negative and there is {@link #MIN_VALUE} that
 * is permitted.
 *
 * @since 2020/06/30
 */
public interface UIFormSpecialPositionType
{
	/** The left command button. */
	byte LEFT_COMMAND =
		-1;
	
	/** The right command button. */
	byte RIGHT_COMMAND =
		-2;
	
	/** The main title which is at the top of the form always. */
	byte TITLE =
		-3;
	
	/** The ticker position which is always below the title. */
	byte TICKER =
		-4;
	
	/** The body of the form, this acts as a "full-screen" view. */
	byte BODY =
		-5;
	
	/** The lowest permitted value, no value can be lower than this. */
	byte MIN_VALUE =
		-5;
}

Added modules/cldc-compact/src/main/java/cc/squirreljme/jvm/mle/constants/UIMetricType.java.



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.mle.constants;

import cc.squirreljme.jvm.mle.UIFormShelf;

/**
 * This contains information on UI metrics used by
 * {@link UIFormShelf#metric(int)}.
 *
 * @since 2020/06/30
 */
public interface UIMetricType
{
	/** Is the UI form engine supported? This metric always works. */
	byte UIFORMS_SUPPORTED =
		0;
	
	/** The number of supported metrics. */
	byte NUM_METRICS =
		1;
}

Added modules/cldc-compact/src/test/java/squirreljme/mle/errors/TestUIFormShelfInvalid.java.













































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package squirreljme.mle.errors;

import cc.squirreljme.jvm.mle.UIFormShelf;
import cc.squirreljme.jvm.mle.constants.UIMetricType;
import cc.squirreljme.jvm.mle.exceptions.MLECallError;
import net.multiphasicapps.tac.UntestableException;

/**
 * Tests whether {@link UIFormShelf} fails as it should with invalid values.
 *
 * @since 2020/06/30
 */
public class TestUIFormShelfInvalid
	extends __BaseMleErrorTest__
{
	/**
	 * {@inheritDoc}
	 * @since 2020/06/22
	 */
	@Override
	public boolean test(int __index)
		throws MLECallError
	{
		// Check to see if forms are actually supported, if not then we cannot
		// check if it is invalid
		if (0 == UIFormShelf.metric(UIMetricType.UIFORMS_SUPPORTED))
			throw new UntestableException("UIForms Not Supported!");
		
		switch (__index)
		{
			case 0:
				UIFormShelf.metric(-1);
				break;
			
			case 1:
				UIFormShelf.metric(UIMetricType.NUM_METRICS);
				break;
			
			default:
				return true;
		}
		
		return false;
	}
}

Added modules/cldc-compact/src/test/resources/squirreljme/mle/errors/TestUIFormShelfInvalid.in.



>
1
result: int:2

Added modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/mle/EnhancedUIFormEngine.java.























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.mle;

import cc.squirreljme.jvm.mle.UIFormShelf;
import cc.squirreljme.jvm.mle.constants.UIMetricType;
import cc.squirreljme.runtime.cldc.debug.Debugging;

/**
 * This is a form engine which is used when UI Forms are supported by the
 * native implementation.
 *
 * @since 2020/06/30
 */
public class EnhancedUIFormEngine
	implements UIFormEngine
{
	/**
	 * {@squirreljme.property cc.squirreljme.runtime.lcdui.mle.fallback=bool
	 * Force the usage of the fallback UIForm in the event that native form
	 * handling should NOT be used.}
	 */
	public static final String FORCE_FALLBACK_PROPERTY =
		"cc.squirreljme.runtime.lcdui.mle.fallback";
	
	/**
	 * {@squirreljme.property cc.squirreljme.runtime.lcdui.mle.headless=bool
	 * Force that the headless UIForm be used, this will mean that nothing
	 * will be displayed on the screen.}
	 */
	public static final String FORCE_HEADLESS_PROPERTY =
		"cc.squirreljme.runtime.lcdui.mle.headless";
	
	/** The instance of the form engine to be used. */
	@SuppressWarnings({"StaticVariableMayNotBeInitialized", 
		"NonConstantFieldWithUpperCaseName"})
	private static UIFormEngine _INSTANCE;
	
	/**
	 * Gets an instance of the UI engine.
	 * 
	 * @return The instance of the engine to use.
	 * @since 2020/06/30
	 */
	@SuppressWarnings("StaticVariableUsedBeforeInitialization")
	public static UIFormEngine getInstance()
	{
		// If this was already cached, use that
		UIFormEngine rv = EnhancedUIFormEngine._INSTANCE;
		if (rv != null)
			return rv;
		
		// Debug
		Debugging.debugNote("Initializing UIFormEngine...");
		
		// These are properties which determine which kind of engine can be
		// returned
		boolean forceFallback = Boolean.getBoolean(
			EnhancedUIFormEngine.FORCE_FALLBACK_PROPERTY);
		boolean forceHeadless = Boolean.getBoolean(
			EnhancedUIFormEngine.FORCE_HEADLESS_PROPERTY);
		boolean isForcing = (forceFallback || forceHeadless);
		
		// Use native forms if supported unless we are forcing other options
		if (0 != UIFormShelf.metric(UIMetricType.UIFORMS_SUPPORTED) &&
			!isForcing)
			rv = new EnhancedUIFormEngine();
		
		// Otherwise use the fallback implementation (raw framebuffer)
		else
		{
			// Use a headless interface? This is if we have no framebuffer
			// and the only have to have graphics is to fake it
			if (forceHeadless)
				throw Debugging.todo("Implement headless.");
			
			throw Debugging.todo("Implement UIForm fallback.");
		}
		
		// Cache and use
		EnhancedUIFormEngine._INSTANCE = rv;
		return rv;
	}
}

Added modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/mle/UIFormEngine.java.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.lcdui.mle;

import cc.squirreljme.jvm.mle.UIFormShelf;

/**
 * This interface is used as a wrapper around {@link UIFormShelf}, it is
 * implemented by a class and essentially is used to forward calls to the
 * true backing implementation. This is here so that in the event that
 * {@link UIFormShelf} is not supported, that there is a fall-back.
 *
 * @since 2020/06/30
 */
public interface UIFormEngine
{
}

Added modules/midp-lcdui/src/main/java/cc/squirreljme/runtime/lcdui/mle/package-info.java.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the mid-level layer support for LCDUI.
 *
 * @since 2020/06/30
 */

package cc.squirreljme.runtime.lcdui.mle;

Changes to modules/midp-lcdui/src/main/java/javax/microedition/lcdui/Display.java.

14
15
16
17
18
19
20


21
22
23
24
25
26

27
28
29
30
31
32
33
...
154
155
156
157
158
159
160

161
162
163
164
165
166
167
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
...
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
...
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973

974
975



976
977
978
979
980
981
982
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.lcdui.ExtendedCapabilities;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.fbui.UIState;


import cc.squirreljme.runtime.lcdui.phoneui.StandardMetrics;
import cc.squirreljme.runtime.cldc.Poking;
import java.util.ArrayList;
import java.util.List;
import javax.microedition.midlet.MIDlet;


public class Display
{
	public static final int ALERT =
		3;

	public static final int CHOICE_GROUP_ELEMENT =
		2;
................................................................................

	public static final int SUPPORTS_MENUS =
		1024;

	public static final int SUPPORTS_ORIENTATION_LANDSCAPE =
		8192;


	public static final int SUPPORTS_ORIENTATION_LANDSCAPE180 =
		32768;

	public static final int SUPPORTS_ORIENTATION_PORTRAIT =
		4096;

	public static final int SUPPORTS_ORIENTATION_PORTRAIT180 =
................................................................................

	public static final int SUPPORTS_TITLE =
		16;

	public static final int TAB =
		4;
	
	/** The number of down keys to store, for a single hand. */
	private static final int _NUM_DOWNKEYS =
		5;
	
	/** Listeners for the display. */
	private static final List<DisplayListener> _LISTENERS =
		new ArrayList<>();
	
	/** The current display which was created. */
	private static Display _DISPLAY;
	
................................................................................
	
	public int[] getExactPlacementPositions(int __b)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the current harware state.
	 *
	 * @return The hardware state.
	 * @since 2018/12/10
	 */
	public int getHardwareState()
	{
		throw new todo.TODO();
................................................................................
	public static Display getDisplay(MIDlet __m)
		throws NullPointerException
	{
		// Check
		if (__m == null)
			throw new NullPointerException("NARG");
		
		// First display already made?
		Display d = Display._DISPLAY;
		if (d != null)
			return d;
		
		// Use the first display that is available.
		// In the runtime, each program only ever gets a single MIDlet and
		// creating new MIDlets is illegal. Thus since getDisplays() has zero
		// be the return value for this method, that is used here.
		Display[] disp = Display.getDisplays(0);
		if (disp.length > 0)
			return disp[0];
................................................................................
		throw new IllegalStateException("EB1p");
	}
	
	/**
	 * Obtains the displays which have the given capability from all internal
	 * display providers.
	 *
	 * @param __caps The capabities to use, this is a bitfield and the values
	 * include all of the {@code SUPPORT_} prefixed constans. If {@code 0} is
	 * specified then capabilities are not checked.
	 * @return An array containing the displays with these capabilities.
	 * @since 2016/10/08
	 */
	public static Display[] getDisplays(int __caps)
	{
		// Poke the VM to initialize things potentially

		Poking.poke();
		



		// Create initial display?
		Display d = Display._DISPLAY;
		if (d == null)
			synchronized (Display.class)
			{
				d = Display._DISPLAY;
				if (d == null)







>
>






>







 







>







 







<
<
<
<







 







|







 







<
<
<
<
<







 







|
|






|
>


>
>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
182
183
184
185
186
187
188




189
190
191
192
193
194
195
...
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
...
936
937
938
939
940
941
942





943
944
945
946
947
948
949
...
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
import cc.squirreljme.jvm.DeviceFeedbackType;
import cc.squirreljme.jvm.Framebuffer;
import cc.squirreljme.jvm.SystemCallError;
import cc.squirreljme.jvm.SystemCallIndex;
import cc.squirreljme.runtime.lcdui.ExtendedCapabilities;
import cc.squirreljme.runtime.lcdui.common.CommonColors;
import cc.squirreljme.runtime.lcdui.fbui.UIState;
import cc.squirreljme.runtime.lcdui.mle.EnhancedUIFormEngine;
import cc.squirreljme.runtime.lcdui.mle.UIFormEngine;
import cc.squirreljme.runtime.lcdui.phoneui.StandardMetrics;
import cc.squirreljme.runtime.cldc.Poking;
import java.util.ArrayList;
import java.util.List;
import javax.microedition.midlet.MIDlet;

@SuppressWarnings("OverlyComplexClass")
public class Display
{
	public static final int ALERT =
		3;

	public static final int CHOICE_GROUP_ELEMENT =
		2;
................................................................................

	public static final int SUPPORTS_MENUS =
		1024;

	public static final int SUPPORTS_ORIENTATION_LANDSCAPE =
		8192;

	@SuppressWarnings("FieldNamingConvention")
	public static final int SUPPORTS_ORIENTATION_LANDSCAPE180 =
		32768;

	public static final int SUPPORTS_ORIENTATION_PORTRAIT =
		4096;

	public static final int SUPPORTS_ORIENTATION_PORTRAIT180 =
................................................................................

	public static final int SUPPORTS_TITLE =
		16;

	public static final int TAB =
		4;
	




	/** Listeners for the display. */
	private static final List<DisplayListener> _LISTENERS =
		new ArrayList<>();
	
	/** The current display which was created. */
	private static Display _DISPLAY;
	
................................................................................
	
	public int[] getExactPlacementPositions(int __b)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the current hardware state.
	 *
	 * @return The hardware state.
	 * @since 2018/12/10
	 */
	public int getHardwareState()
	{
		throw new todo.TODO();
................................................................................
	public static Display getDisplay(MIDlet __m)
		throws NullPointerException
	{
		// Check
		if (__m == null)
			throw new NullPointerException("NARG");
		





		// Use the first display that is available.
		// In the runtime, each program only ever gets a single MIDlet and
		// creating new MIDlets is illegal. Thus since getDisplays() has zero
		// be the return value for this method, that is used here.
		Display[] disp = Display.getDisplays(0);
		if (disp.length > 0)
			return disp[0];
................................................................................
		throw new IllegalStateException("EB1p");
	}
	
	/**
	 * Obtains the displays which have the given capability from all internal
	 * display providers.
	 *
	 * @param __caps The capabilities to use, this is a bitfield and the values
	 * include all of the {@code SUPPORT_} prefixed constants. If {@code 0} is
	 * specified then capabilities are not checked.
	 * @return An array containing the displays with these capabilities.
	 * @since 2016/10/08
	 */
	public static Display[] getDisplays(int __caps)
	{
		// Poke the VM to initialize things potentially, this is just needed
		// by the native emulator bindings
		Poking.poke();
		
		// Obtain the engine
		UIFormEngine engine = EnhancedUIFormEngine.getInstance();
		
		// Create initial display?
		Display d = Display._DISPLAY;
		if (d == null)
			synchronized (Display.class)
			{
				d = Display._DISPLAY;
				if (d == null)