小编And*_*Kor的帖子

Eclipse Kepler在创建新的Android应用程序项目时崩溃

正如标题所示,每次我创建一个新的Android应用程序项目时它都会崩溃.但是,当我创建一个新的Java项目时,它似乎运行正常.我得到的错误代码是:Java已启动但​​返回退出代码:-805306369.

这就是我可以发布的内容,我似乎无法复制错误消息(它是一个弹出窗口,不会出现在控制台上)

正如它将要加载项目一样,eclipse长时间没有响应,所以我被迫关闭它并得到错误消息.

任何帮助将不胜感激,谢谢.

eclipse crash android eclipse-kepler

5
推荐指数
1
解决办法
4816
查看次数

如何在保持纵横比的同时调整 JFrame 的大小?

我希望用户能够调整 JFrame 的宽度/高度的大小,同时保持其宽度和高度之间的相同比率。换句话说,我想强制高度改变,宽度保持相同的框架形状。

public void componentResized(ComponentEvent arg0)
    {
        int setHeight = arg0.getComponent().getHeight();
        int setWidth = arg0.getComponent().getWidth();
        double newWidth = 0;
        double newHeight = 0;
        {
            if(setHeight != oldHeight)
            {
                heightChanged = true;
            }
            if(setWidth != oldWidth)
            {
                widthChanged = true;
            }
        }
        {
            if(widthChanged == true && heightChanged == false)
            {
                newWidth = setWidth;
                newHeight = setWidth*HEIGHT_RATIO;
            }
            else if(widthChanged == false && heightChanged == true)
            {
                newWidth = setHeight * WIDTH_RATIO;
                newHeight = setHeight;
            }
            else if(widthChanged == true …
Run Code Online (Sandbox Code Playgroud)

java swing resize jframe

2
推荐指数
1
解决办法
9189
查看次数

同步方法究竟做了什么?

我正在使用Swing创建一个游戏.我制作start()stop()同步,因为我被告知它更好.同步做什么以及使用它有什么好处?

我的代码:

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import javax.swing.JFrame;

public class SpritePractice extends Canvas implements Runnable{

private JFrame frame;
private final static int WIDTH = 200, HEIGHT = 200;
private final static int SCALE = 2;
private final static Dimension dimens= new Dimension(WIDTH*SCALE, HEIGHT*SCALE);
private BufferedImage image;
private Graphics g;
private long nanoSecond = 1000000000;
private double tick = nanoSecond/60;
private boolean running …
Run Code Online (Sandbox Code Playgroud)

java methods synchronized runnable

2
推荐指数
1
解决办法
862
查看次数

在'android'包中找不到属性'weight'的资源标识符?

我编译时不断收到此错误:在'android'包中找不到属性'weight'的资源标识符.我怎样才能解决这个问题?码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<TextView

    android:text="@string/enter_name" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    />

<EditText 
    android:hint="@string/hint_one"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:weight="1"
    />
<EditText 
    android:hint="@string/hint_two"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:weight="1"
    />

<Button
    android:text="@string/send_message"   
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    />
Run Code Online (Sandbox Code Playgroud)

xml android

1
推荐指数
1
解决办法
3339
查看次数