- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有两个类,一类用于 io/reading 文件,另一类用于 GUI,在过去的几天里,我正在研究 io/reading 类,我使用简单的技术通过写入从硬盘获取文件文件名仅作为字符串 注意:查看代码,但是现在在我完成 io/reading 代码后,我需要使用更专业的方式添加 JFileChooser
在 Gui 类中并将它们结合起来,这就是困难,有人可以告诉我怎么做吗?
Jfilechooser
GUI 类中的 constrictor 内的代码只会打开 JFileChooser
并选择文件并将文件保存到String srtPath
.
Action openAction = new AbstractAction("Open Subtitle", openIcon) {
@Override
public void actionPerformed(ActionEvent e) {
ourFileSelector.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
ourFileSelector.showSaveDialog(null);
ourSrtFile = ourFileSelector.getSelectedFile();
srtPath = ourSrtFile.getAbsolutePath();
}
};
读取文件的所有类
package AnimeAid;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ReadFile {
public static ArrayList<String> getFileStartingTime(String file){
ArrayList<String> Lines = new ArrayList<String>();
//String file = "tra.srt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line;
while((line = br.readLine()) != null) {
if (line.indexOf(':') != -1 && line.indexOf(',') != -1 && line.indexOf('0') != -1) {
Lines.add(line.substring(0, 12));
}
}
}catch(IOException ex){
System.err.println(ex);
}
return Lines;
}
public static ArrayList<String> getFileEndingTime(String file){
ArrayList<String> Lines = new ArrayList<String>();
//String file = "tra.srt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line;
while((line = br.readLine()) != null) {
if (line.indexOf(':') != -1 && line.indexOf(',') != -1 && line.indexOf('0') != -1) {
Lines.add(line.substring(18, 29));
}
}
}catch(IOException ex){
System.err.println(ex);
}
return Lines;
}
public static ArrayList<String> readSubtitles(String file)
{
ArrayList<String> Lines = new ArrayList<String>();
try{
//String file = "tra.srt";
Charset charset = Charset.defaultCharset();
Path path = Paths.get(file);
byte[] encoded = Files.readAllBytes(path);
String data = charset.decode(ByteBuffer.wrap(encoded)).toString();
Pattern p = Pattern.compile("(\\d+:\\d+:\\d+,\\d+) --> (\\d+:\\d+:\\d+,\\d+)\\s*(.*?)\\s*(^$|\\Z)", Pattern.DOTALL | Pattern.MULTILINE);
Matcher m = p.matcher(data);
while (m.find()){
//String startTime = m.group(1);
//String endTime = m.group(2);
//String subtitle = m.group(3);
Lines.add(m.group(3));
//System.out.println(startTime);
//System.out.println(endTime);
}
}catch(IOException ex){
System.err.println(ex);
}
return Lines;
}
public static ArrayList<String> ArraylineLengths(String file) {
ArrayList<String> Lines = new ArrayList<String>();
//String file = "tra.srt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line;
while((line = br.readLine()) != null) {
line = line.replace("\uFEFF", "");
if(isInteger(line)) {
int i = Integer.parseInt(line);
if(i > 0) {
Lines.add(line);
}
}
}
} catch(IOException ioe) {
ioe.printStackTrace();
} finally {
if(br != null) {
try {
br.close();
} catch(IOException e) {
// do nothing
}
}
}
return (Lines);
}
public static boolean isInteger(String s) {
try {
Integer.parseInt(s);
} catch(NumberFormatException e) {
return false;
}
// only got here if we didn't return false
return true;
}
public static int maxLine(String file){
try
{
//String file = "tra.srt";
int max = 0;
BufferedReader br = null;
try { br = new BufferedReader(new FileReader(file)); }
catch (FileNotFoundException e) { System.out.println(e); }
String line;
while((line = br.readLine()) != null)
{
if (isInteger(line))
{
max++;
}
}
return max+1;
}
catch( NumberFormatException | IOException ex) {ex.printStackTrace();}
return 0;
}
}
答案应该是这样的
String file = GuiInterface.srtPath;
我尝试过这个
public class ReadFile {
GuiInterface tt = new GuiInterface(null);
public static String file = GuiInterface.srtPath;
public static ArrayList<String> getFileStartingTime(){
ArrayList<String> Lines = new ArrayList<String>();
//String file = "tra.srt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line;
while((line = br.readLine()) != null) {
if (line.indexOf(':') != -1 && line.indexOf(',') != -1 && line.indexOf('0') != -1) {
Lines.add(line.substring(0, 12));
}
}
}catch(IOException ex){
System.err.println(ex);
}
return Lines;
}
但是当我使用这个vlcj库时只显示视频。
这是我向 Jtable 添加数据的方式
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package AnimeAid;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.BorderFactory.*;
import javax.swing.border.*;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
/**
*
* @author isslam
*/
public class GuiInterface extends JFrame {
JComboBox laList;
ReadFile reader;
private final int numberOfButton = 6;
private final JTable table;
JToolBar toolBar;
private final JTextField enterText,startTime,endTime;
private final JMenu jMenu1,jMenu2,jMenu3;
private final JMenuBar jMenuBar1;
private final JMenuItem itemNewSrt,itemOpenVideo,itemSavefile;
private static JFileChooser ourFileSelector,ourVideoSelector;
File ourVideoFile,ourSrtFile;
Border Campound,empty,Boveld,etch;
private final JLabel startTimeingLable,endTimeingLabel;
public static String mediaPath="",srtPath="";
Canvas c;
ImageIcon[] icon;
JButton[] Obutton;
static final int COLUMN = 4 ;
public static void main(String[] args) throws IOException
{
//ReadFile.readSubtitles();
NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:\\Program Files\\VideoLAN\\VLC");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new GuiInterface("");
}
});
}
public GuiInterface(String title){
//reader = new ReadFile();
setSize(1024, 720);
setVisible(true);
setTitle("AnimeFactor");
setDefaultCloseOperation(GuiInterface.EXIT_ON_CLOSE);
//video setting
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory();
c = new Canvas();
String[] petStrings = { "Translation Line", "Both Line" };
laList = new JComboBox(petStrings);
c.setBackground(Color.black);
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
p.add(c, BorderLayout.CENTER);
add(p, BorderLayout.CENTER);
EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();
mediaPlayer.setVideoSurface(mediaPlayerFactory.newVideoSurface(c));
mediaPlayer.playMedia("C:\\Users\\isslam\\Downloads\\gg.mp4");
/* String[] columnNames = {"#","Start","End","Translation column"};
Object[][] data = new Object [ReadFile.maxLine(srtPath)][COLUMN];
ArrayList <String > Dumy = new ArrayList<String>();
//String [] countries = list.toArray(new String[list.size()]);
Dumy = ReadFile.ArraylineLengths(srtPath);
for(int i = 0; i < Dumy.size(); i++)
{
data[i][0] = Dumy.get(i);
}
ArrayList<String> ends = ReadFile.getFileEndingTime(srtPath);
ArrayList<String> starts = ReadFile.getFileStartingTime(srtPath);
ArrayList<String> subs = ReadFile.readSubtitles(srtPath);
for(int i=0;i < ReadFile.maxLine(srtPath);i++){
// data[i][0] = ReadFile.lineLengths();
data[i][1] = starts.get(i) ;
data[i][2] = ends.get(i);
data[i][3] = subs.get(i);
}
DefaultTableModel model = new DefaultTableModel(data, columnNames);
*/
ImageIcon openIcon = new ImageIcon(
GuiInterface.class.getResource("/resources/image/folder-icon.png"));
ImageIcon saveIcon = new ImageIcon(
GuiInterface.class.getResource("/resources/image/red-disk-icon.png"));
ImageIcon newIcon = new ImageIcon(
GuiInterface.class.getResource("/resources/image/Actionsnew-icon.png"));
Action saveAction = new AbstractAction("Save", saveIcon) {
@Override
public void actionPerformed(ActionEvent e) {
}
};
Action newAction = new AbstractAction("New", newIcon) {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("New File");
}
};
jMenu1 = new JMenu("File");
jMenu2 = new JMenu("Video");
jMenu3 = new JMenu("Subtitle");
itemNewSrt = new JMenuItem(newAction);
jMenu1.add(itemNewSrt);
itemSavefile = new JMenuItem(saveAction);
jMenu1.add(itemSavefile);
jMenuBar1 = new JMenuBar();
jMenuBar1.setBorder(etch);
setJMenuBar(jMenuBar1);
jMenuBar1.add(jMenu1);
jMenuBar1.add(jMenu2);
jMenuBar1.add(jMenu3);
table = new JTable();
table.setFillsViewportHeight(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
TableColumn columnA = table.getColumn("#");
columnA.setMinWidth(10);
columnA.setMaxWidth(40);
TableColumn columnB= table.getColumn("Start");
columnB.setMinWidth(80);
columnB.setMaxWidth(90);
TableColumn columnC= table.getColumn("End");
columnC.setMinWidth(80);
columnC.setMaxWidth(90);
Obutton = new JButton[numberOfButton];
etch = BorderFactory.createEtchedBorder();
enterText = new JTextField();
enterText.setPreferredSize(new Dimension(0,100));
ourFileSelector = new JFileChooser();
startTime = new JTextField();
startTime.setPreferredSize(new Dimension(120, 20));
startTimeingLable = new JLabel("Starting Time");
endTimeingLabel = new JLabel("Ending Time");
endTime = new JTextField();
endTime.setPreferredSize(new Dimension(120, 20));
toolBar = new JToolBar();
//toolBar.add(Box.createHorizontalGlue());
toolBar.setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
toolBar.add(newAction);
toolBar.add(saveAction);
JPanel toolBarPane = new JPanel(new BorderLayout());
toolBarPane.add(toolBar,BorderLayout.NORTH);
JPanel timing = new JPanel(new FlowLayout(FlowLayout.TRAILING));
timing.add(startTimeingLable);
timing.add(startTime);
timing.add(endTimeingLabel);
timing.add(endTime);
timing.add(laList);
empty = BorderFactory.createEmptyBorder(30, 5, 5, 5);
Boveld = BorderFactory.createBevelBorder(BevelBorder.RAISED);
Campound = BorderFactory.createCompoundBorder(empty,Boveld);
JPanel textFiled = new JPanel(new BorderLayout());
textFiled.add(timing);
textFiled.add(enterText,BorderLayout.SOUTH);
textFiled.setBorder(Campound);
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane, BorderLayout.SOUTH);
add(textFiled, BorderLayout.EAST);
add(toolBarPane,BorderLayout.PAGE_START);
Action openAction = new AbstractAction("Open Subtitle", openIcon) {
@Override
public void actionPerformed(ActionEvent e) {
ourFileSelector.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
ourFileSelector.showSaveDialog(null);
ourSrtFile = ourFileSelector.getSelectedFile();
srtPath = ourSrtFile.getAbsolutePath();
DefaultTableModel model = createModel(srtPath);
table.setModel(model);
}
};
//Container cp = getContentPane();
toolBar.add(openAction);
itemOpenVideo = new JMenuItem(openAction);
jMenu1.add(itemOpenVideo);
itemOpenVideo.addActionListener(new MenuBarMethod());
}
private DefaultTableModel createModel(String srtPath) {
String[] columnNames = {"#", "Start", "End", "Translation column"};
int maxLine = ReadFile.maxLine(srtPath); // debug
//Object[][] data = new Object[maxLine][];
System.out.println(maxLine); // debug
DefaultTableModel model = new DefaultTableModel(columnNames, 0);
ArrayList<String> ends = ReadFile.getFileEndingTime(srtPath);
ArrayList<String> starts = ReadFile.getFileStartingTime(srtPath);
ArrayList<String> subs = ReadFile.readSubtitles(srtPath);
for (int i = 0; i < ReadFile.maxLine(srtPath) - 1; i++) {
model.addRow(new Object[] {starts.get(i), ends.get(i), subs.get(i)});
}
return model;
}
public class MenuBarMethod implements ActionListener{
@Override
public void actionPerformed(ActionEvent a){
Object buttonPressed=a.getSource();
if(buttonPressed.equals(itemOpenVideo)){
ourVideoSelector.setFileSelectionMode(JFileChooser.FILES_ONLY);
ourVideoSelector.showSaveDialog(null);
ourVideoFile = ourVideoSelector.getSelectedFile();
mediaPath = ourVideoFile.getAbsolutePath();
}
}
}
}
代码的问题是这部分代码不起作用
table = new JTable();
table.setFillsViewportHeight(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
TableColumn columnA = table.getColumn("#");
columnA.setMinWidth(10);
columnA.setMaxWidth(40);
TableColumn columnB= table.getColumn("Start");
columnB.setMinWidth(80);
columnB.setMaxWidth(90);
TableColumn columnC= table.getColumn("End");
columnC.setMinWidth(80);
columnC.setMaxWidth(90);
文件的一部分
1
00:00:01,600 --> 00:00:04,080
<b>Mr Magnussen, please state your
full name for the record.</b>
2
00:00:04,080 --> 00:00:07,040
Charles Augustus Magnussen.
现在这是应用程序的图片
如您所见,由于某种原因,打开文件进行读取的图标不存在,JTextFiled 下的白色背景表明 jtable 已创建,但还没有任何信息
最佳答案
"The answer should be something like this"
String file = GuiInterface.srtPath;
您的GuiInterface
是正在运行的类。由于 ReadFile
是一个具有 static
方法的“帮助类”,因此它不必了解有关 GuiInterface
类。
您应该做的是让 getFileStartingTime()
接受一个 String path
参数,并让 FileReader
使用该 路径
参数。
public static ArrayList<String> getFileStartingTime(String path) {
ArrayList<String> Lines = new ArrayList<String>();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(path));
然后,当您应该从 Action
调用 ReadFile.getFileStartTime(...)
时,并对返回的 ArrayList
执行某些操作。类似的东西
File ourSrtFile = ourFileSelector.getSelectedFile();
String srtPath = ourSrtFile.getAbsolutePath();
ArrayList<String> array = ReadFile.getFileStartingTime(srtPath);
DefaultListModel model = (DefaultListModel) list.getModel();
for (String s : array) {
model.addElement(s);
}
<小时/>
这是一个完整的示例。但请注意:读取文件(和长时间运行的任务)应该在后台线程中完成,可能使用 SwingWorker ,但我现在懒得这么做。你可以看一下链接
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
public class GuiInterface {
private JFileChooser ourFileSelector = new JFileChooser();
private JList list = new JList(new DefaultListModel());
public GuiInterface() {
Action openAction = new AbstractAction("Open Subtitle") {
@Override
public void actionPerformed(ActionEvent e) {
ourFileSelector.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
ourFileSelector.showSaveDialog(null);
File ourSrtFile = ourFileSelector.getSelectedFile();
String srtPath = ourSrtFile.getAbsolutePath();
ArrayList<String> array = ReadFile.getFileStartingTime(srtPath);
DefaultListModel model = (DefaultListModel) list.getModel();
for (String s : array) {
model.addElement(s);
}
}
};
JButton button = new JButton(openAction);
JFrame frame = new JFrame();
JScrollPane scroll = new JScrollPane(list);
scroll.setPreferredSize(new Dimension(200, 300));
frame.add(scroll);
frame.add(button, BorderLayout.SOUTH);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] aregs) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new GuiInterface();
}
});
}
}
class ReadFile {
public static ArrayList<String> getFileStartingTime(String path) {
ArrayList<String> Lines = new ArrayList<String>();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(path));
String line;
while ((line = br.readLine()) != null) {
Lines.add(line);
}
} catch (IOException ex) {
System.err.println(ex);
}
return Lines;
}
}
<小时/>
编辑
现在就试试这个
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
public class GuiInterface {
private JFileChooser ourFileSelector = new JFileChooser();
private JTable table = new JTable();
public GuiInterface() {
Action openAction = new AbstractAction("Open Subtitle") {
@Override
public void actionPerformed(ActionEvent e) {
ourFileSelector.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
ourFileSelector.showSaveDialog(null);
File ourSrtFile = ourFileSelector.getSelectedFile();
String srtPath = ourSrtFile.getAbsolutePath();
DefaultTableModel model = createModel(srtPath);
table.setModel(model);
}
};
JButton button = new JButton(openAction);
JFrame frame = new JFrame();
JScrollPane scroll = new JScrollPane(table);
//scroll.setPreferredSize(new Dimension(200, 300));
frame.add(scroll);
frame.add(button, BorderLayout.SOUTH);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
private DefaultTableModel createModel(String srtPath) {
String[] columnNames = {"#", "Start", "End", "Translation column"};
int maxLine = ReadFile.maxLine(srtPath); // debug
//Object[][] data = new Object[maxLine][];
System.out.println(maxLine); // debug
DefaultTableModel model = new DefaultTableModel(columnNames, 0);
ArrayList<String> ends = ReadFile.getFileEndingTime(srtPath);
ArrayList<String> starts = ReadFile.getFileStartingTime(srtPath);
ArrayList<String> subs = ReadFile.readSubtitles(srtPath);
for (int i = 0; i < ReadFile.maxLine(srtPath) - 1; i++) {
model.addRow(new Object[] {starts.get(i), ends.get(i), subs.get(i)});
}
return model;
}
public static void main(String[] aregs) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new GuiInterface();
}
});
}
}
class ReadFile {
public static ArrayList<String> getFileStartingTime(String file) {
ArrayList<String> Lines = new ArrayList<String>();
//String file = "tra.srt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
if (line.indexOf(':') != -1 && line.indexOf(',') != -1 && line.indexOf('0') != -1) {
Lines.add(line.substring(0, 12));
}
}
} catch (IOException ex) {
System.err.println(ex);
}
return Lines;
}
public static ArrayList<String> getFileEndingTime(String file) {
ArrayList<String> Lines = new ArrayList<String>();
//String file = "tra.srt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
if (line.indexOf(':') != -1 && line.indexOf(',') != -1 && line.indexOf('0') != -1) {
Lines.add(line.substring(18, 29));
}
}
} catch (IOException ex) {
System.err.println(ex);
}
return Lines;
}
public static ArrayList<String> readSubtitles(String file) {
ArrayList<String> Lines = new ArrayList<String>();
try {
//String file = "tra.srt";
Charset charset = Charset.defaultCharset();
Path path = Paths.get(file);
byte[] encoded = Files.readAllBytes(path);
String data = charset.decode(ByteBuffer.wrap(encoded)).toString();
Pattern p = Pattern.compile("(\\d+:\\d+:\\d+,\\d+) --> (\\d+:\\d+:\\d+,\\d+)\\s*(.*?)\\s*(^$|\\Z)", Pattern.DOTALL | Pattern.MULTILINE);
Matcher m = p.matcher(data);
while (m.find()) {
//String startTime = m.group(1);
//String endTime = m.group(2);
//String subtitle = m.group(3);
Lines.add(m.group(3));
//System.out.println(startTime);
//System.out.println(endTime);
}
} catch (IOException ex) {
System.err.println(ex);
}
return Lines;
}
public static ArrayList<String> ArraylineLengths(String file) {
ArrayList<String> Lines = new ArrayList<String>();
//String file = "tra.srt";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
line = line.replace("\uFEFF", "");
if (isInteger(line)) {
int i = Integer.parseInt(line);
if (i > 0) {
Lines.add(line);
}
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
// do nothing
}
}
}
return (Lines);
}
public static boolean isInteger(String s) {
try {
Integer.parseInt(s);
} catch (NumberFormatException e) {
return false;
}
// only got here if we didn't return false
return true;
}
public static int maxLine(String file) {
try {
//String file = "tra.srt";
int max = 0;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e) {
System.out.println(e);
}
String line;
while ((line = br.readLine()) != null) {
if (isInteger(line)) {
max++;
}
}
return max + 1;
} catch (NumberFormatException | IOException ex) {
ex.printStackTrace();
}
return 0;
}
}
关于java - 使用其他类中的 JFileChooser 选择文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22716160/
是否有某种方法可以使用 JPA 或 Hibernate Crtiteria API 来表示这种 SQL?或者我应该将其作为 native 执行吗? SELECT A.X FROM (SELECT X,
在查询中, select id,name,feature,marks from (....) 我想删除其 id 在另一个 select 语句中存在的那些。 从 (...) 中选择 id 我是 sql
我想响应用户在 select 元素中选择一个项目。然而这个 jQuery: $('#platypusDropDown').select(function () { alert('You sel
这个问题在这里已经有了答案: SQL select only rows with max value on a column [duplicate] (27 个回答) 关闭8年前。 我正在学习 SQL
This question already has answers here: “Notice: Undefined variable”, “Notice: Undefined index”, and
我在 php 脚本中调用 SQL。有时“DE”中没有值,如果是这种情况我想从“EN”中获取值 应该是这样的,但不是这样的 IF (EXISTS (SELECT epf_application_deta
这可能是一个奇怪的问题,但不知道如何研究它。执行以下查询时: SELECT Foo.col1, Foo.col2, Foo.col3 FROM Foo INNER JOIN Bar ON
如何在使用 Camera.DestinationType.FILE_URI. 时在 phonegap camera API 中同时选择或拾取多个图像我能够一次只选择一张图像。我可以使用 this 在
这是一个纯粹的学术问题。这两个陈述实际上是否相同? IF EXISTS (SELECT TOP 1 1 FROM Table1) SELECT 1 ELSE SELECT 0 相对 IF EXIS
我使用 JSoup 来解析 HTML 响应。我有多个 Div 标签。我必须根据 ID 选择 Div 标签。 我的伪代码是这样的 Document divTag = Jsoup.connect(link
我正在处理一个具有多个选择框的表单。当用户从 selectbox1 中选择一个选项时,我需要 selectbox2 active 的另一个值。同样,当他选择 selectbox2 的另一个值时,我需要
Acme Inc. Christa Woods Charlotte Freeman Jeffrey Walton Ella Hubbard Se
我有一个login.html其中form定义如下: First Initial Plus Last Name : 我的do_authorize如下: "; pri
$.get( 'http://www.ufilme.ro/api/load/maron_online/470', function(data
我有一个下拉列表“磅”、“克”、“千克”和“盎司”。我想要这样一种情况,当我选择 gram 来执行一个函数时,当我在输入字段中输入一个值时,当我选择 pounds 时,我想要另一个函数来执行时我在输入
我有一个 GLSL 着色器,它从输入纹理的 channel 之一(例如 R)读取,然后写入输出纹理中的同一 channel 。该 channel 必须由用户选择。 我现在能想到的就是使用一个 int
我想根据下拉列表中的选定值生成输入文本框。 Options 2 3 4 5 就在这个选择框之后,一些输入字段应该按照选定的数字出现。 最佳答案 我建议您使用响应式(Reac
我是 SQL 新手,我想问一下如何根据首选项和分组选择条目。 +----------+----------+------+ | ENTRY_ID | ROUTE_ID | TYPE | +------
我有以下表结构: CREATE TABLE [dbo].[UTS_USERCLIENT_MAPPING_USER_LIST] ( [MAPPING_ID] [int] IDENTITY(1,1
我在移除不必要的床单时遇到了问题。我查看了不同的论坛并将不同的解决方案混合在一起。 此宏删除工作表(第一张工作表除外)。 Sub wrong() Dim sht As Object Applicati
我是一名优秀的程序员,十分优秀!