在我的应用程序中,我集成了OpenStreetMap,其中我已经获取了源和目标坐标.我需要使用Intent类将这些坐标传递给OpenStreetMap App ,因为我需要Uri.
经过2天的搜索,我得到了这个Uri
http://www.openstreetmap.org/?mlat=latitude&mlon=longitude&zoom=12
目前只支持一个位置,但我不想要它.
有人可以帮我这个吗?提前致谢...
这是我的代码如下
Intent sendLocationToMap = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://openstreetmap.org/?mlat=13.074847&mlon=80.271019&zoom=12"));
startActivity(sendLocationToMap);
Run Code Online (Sandbox Code Playgroud) 当我尝试对齐我的组件时,它会左侧或右侧.
所以我只是希望解决方案摆脱这个问题,并告诉我如何将面板的大小设置为400 x 350像素.

这里是我的代码.... titleLabel并ResultLabel应在中心对齐
public TimeGui() {
layout = new GridBagLayout();
setSize(400, 350); //**Its not working**
setBackground(Color.LIGHT_GRAY);
setBorder(BorderFactory.createLineBorder(Color.BLACK));
setBorder(new TitledBorder(new EtchedBorder(), "Time Conversion") );
setLayout(layout);
layoutConstraints = new GridBagConstraints();
textField1 = new JTextField(10);
textField2 = new JTextField(10);
String[] names1 = {"Seconds", "Minutes", "Hours", "Days", "Weeks"};
comboBox1 = new JComboBox<>(names1);
comboBox2 = new JComboBox<>(names1);
titleLabel = new JLabel("Time Conversion Unit", JLabel.CENTER);
resultLabel = new JLabel("Result Label");
equalLabel = new JLabel("=");
convertButton = new JButton("Convert");
layoutConstraints.fill = …Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序中实现树结构视图,它应该同时水平和垂直滚动,与Android SDK中的树概述(用于查找布局结构)完全相同.请,请.
我写了时间转换程序(即秒到分钟和分钟等),但后来我发现这些类执行类似的操作.有没有办法将这些类联系起来,如果有的话请给出一些解决方案和建议.这是我的代码....
Second.java
import java.util.concurrent.*;
public class Second {
private long secondsValue;
public Second() {
secondsValue = 0L;
}
public Second(String from, String to, long unitValue) {
unitSelection(from, to, unitValue);
}
private void convertSecondToMinute(long unitValue) {
unitValue = TimeUnit.MINUTES.convert(unitValue, TimeUnit.SECONDS);
secondsValue = unitValue;
}
private void convertSecondToHour(long unitValue) {
unitValue = TimeUnit.HOURS.convert(unitValue, TimeUnit.SECONDS);
secondsValue = unitValue;
}
private void convertSecondToDay(long unitValue) {
unitValue = TimeUnit.DAYS.convert(unitValue, TimeUnit.SECONDS);
secondsValue = unitValue;
}
private void convertSecondToWeek(long unitValue) {
unitValue = unitValue/60/60/24/7;
secondsValue = unitValue; …Run Code Online (Sandbox Code Playgroud)